PDA

View Full Version : javascript代码如何从视图中一条一条取到文档!


luoshao
31-07-06, 12:16 PM
javascript代码如何从视图中一条取到文档!
相当于,以下代码功能:
set doc=view.getfirstdocumentdocument
while Not doc is nothing
str=doc.fieldname(0)
set doc=view.getnexdocument(doc)
wend

死扛Lotus
31-07-06, 01:47 PM
除了在javascript里面运行代理,javascirpt 是不能从视图中一条一条取得文档的

必须在LOTUSSCRIPT中取得文档后,把需要的参数再传给javascript.

luoshao
31-07-06, 02:08 PM
代理里好象不能写javascript吧,那么想请教一下,用lotusscript取出来的值存在哪里,才能用javascript去找到!

死扛Lotus
31-07-06, 02:32 PM
存到变量里呀,然后再根据变量来传参

给你一个传参的例子

Set vw = db.GetView(strView)
vw.SelectionFormula = strFormula
colMax = Ubound(strColValue)

Print |正在统计,请稍候...|
'print col name
Print |<script language="javascript"> |
Print |<!--
var oXL
var oBook
var oSheet
var oXL = new ActiveXObject("Excel.Application");
oBook = oXL.Workbooks.Add();
oSheet = oBook.ActiveSheet;
oSheet.Cells(1,1).Value = "| & strTitle & |";|
For i = 0 To colMax-1
Print |oSheet.Cells(2,1).Value = "序号";|
Print |oSheet.Cells(2,| & Cstr(i+2) & |).Value = "| & strColName(i) & |";|
Next
j = 3
Set doc = vw.GetFirstDocument
While Not (doc Is Nothing)
For i = 0 To colMax-1

Set temItem = doc.GetFirstItem(strColValue(i))
' vValue = temItem.Values
'=========================================
If temItem Is Nothing Then
Messagebox "error"

Print |oSheet.Cells(| & Cstr(j) & |,| & Cstr(i+2) & |).Value = "| & |未分类| & |";|
Else
vValue = temItem.Values
Messagebox vValue(0)
Print |oSheet.Cells(| & Cstr(j) & |,| & Cstr(i+2) & |).Value = "| & Cstr(vValue(0)) & |";|
End If

'========================================
Print |oSheet.Cells(| & Cstr(j) & |,1).Value = "| & Cstr(j-2) & |";|
' Print |oSheet.Cells(| & Cstr(j) & |,| & Cstr(i+2) & |).Value = "| & Cstr(vValue(0)) & |";|
Next
j = j + 1
Set doc = vw.GetNextDocument(doc)

Wend

Print |oXL.Visible = true; |
Print |window.history.go(-1); |
Print |--> |
Print |</script> |