Lotus notes 服务器中的图形呈现不正确

Lotus notes 服务器中的图形呈现不正确,lotus-notes,Lotus Notes,我在development server notes客户端中部署了一个应用程序。应用程序组成了一个函数,用于在图形生成过程中导出用户本地机器中的数据。我的问题是,当导出数据时,服务器中的图形渲染不正确,但当我在本地计算机中运行它时,图形渲染是正常的。 我在本地机器上使用了MS 2007,但在开发服务器上没有安装MS Office。有什么方法可以做到这一点吗?下面是代码 Dim s As New notessession Dim db As notesdatabase Set db= s.curr

我在development server notes客户端中部署了一个应用程序。应用程序组成了一个函数,用于在图形生成过程中导出用户本地机器中的数据。我的问题是,当导出数据时,服务器中的图形渲染不正确,但当我在本地计算机中运行它时,图形渲染是正常的。 我在本地机器上使用了MS 2007,但在开发服务器上没有安装MS Office。有什么方法可以做到这一点吗?下面是代码

Dim s As New notessession
Dim db As notesdatabase
Set db= s.currentdatabase
Dim uiw As New NotesUIWorkspace
Dim otherdoc As NotesDocument
Dim otherview As NotesView
Dim othercol As NotesDocumentCollection
Dim ViewNav As NotesViewNavigator
Dim entry As notesViewEntry

Dim tempdoc As notesdocument

Dim uiv As notesuiview
Set uiv = uiw.currentview
Dim VName As String
VName = uiv.ViewName

'if it is R4 then viewalias doesn't work so use
'environment variable stashed in the post open event
If Instr(s.Notesversion, "Release 4") Then
    currentviewname = s.getenvironmentstring("Tracking")
    If currentviewname="" Then
        Msgbox "View not exist."
        End
    End If
    Call s.setenvironmentvar("Tracking","")
Elseif uiv.viewalias <> "" Then 'use alias if it isn't blank
    currentviewname = uiv.viewalias
Else ' use name
    currentviewname = uiv.viewname
End If

'Get the view
Set otherview = db.GetView(currentviewname)
If otherview Is Nothing Then
    Messagebox "Could not open the view. """ & currentviewname & """"
    Exit Sub
End If

'Check if it is for all documents or only selected
Set othercol = db.unprocesseddocuments
If othercol.count >1 Then 'if more than one doc selected then confirm
    resp = Messagebox("Do you want to export only the " & _
    "selected " & othercol.count & " documents?", 36, "Selected only?" )
    If resp=6 Then
    Else
        Exit Sub
    End If
Else
    Messagebox "Exporting all rows. (To export only selected " & _
    "rows tick those required in the left margin first.)"
End If '6= yes

Dim object As NotesEmbeddedObject
Dim xlApp As Variant
Dim oWorkbook As Variant

Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True 'set to visible, this can be moved to the end if you wish

Set oworkbook = xlApp.Workbooks 'handle to Workbook
oworkbook.Add

'Stick out the column headers
hcolmn=1
Forall c In otherview.Columns
    xlApp.cells(1,hcolmn) = c.title
    hcolmn=hcolmn+1
End Forall

row=2

Dim vc As NotesViewEntryCollection
Dim seldoc As notesdocument
Dim view As notesview
Set view = db.GetView(VName)
Set vc = view.AllEntries

If resp=6 Then
    Set seldoc = othercol.GetFirstDocument
    While Not seldoc Is Nothing
        Set entry = vc.GetEntry(selDoc)
        Print "Entry " entry.noteID " from document " selDoc.noteID '<--- new line
        'Msgbox row
        For colmn = 0 To Ubound(entry.ColumnValues)
            col% = col% + 1
            xlApp.cells(row,colmn+1) = entry.columnvalues(colmn)
        Next

        row=row+1
        Set seldoc = othercol.GetNextDocument(seldoc)
    Wend
Else ' all documents
    Set otherdoc = otherview.GetFirstDocument
    While Not otherdoc Is Nothing
        For colmn = 0 To Ubound(otherview.Columns)
            xlApp.cells(row,colmn+1) = otherdoc.columnvalues(colmn)
        Next
        row=row+1
        Set otherdoc = otherview.GetNextDocument(otherdoc)
    Wend
End If

'this highlights the headings
xlApp.application.Rows("1:1").Select
With xlApp.application.Selection.Font
    .bold = True
    .ColorIndex = 48
    .Name = "Arial"
    .Size = 10
End With

'this freezes the panes
xlApp.application.Rows("2:2").Select
xlApp.application.ActiveWindow.FreezePanes = True

xlChartType = 51
xlapp.ActiveWorkbook.Charts.Add

With xlapp.ActiveWorkbook.ActiveChart
    .Name = "Chart"
    .HasTitle = True
    .ChartTitle.Text = "Total Submissions Received per Month"
    .Axes("1").HasTitle = True 'xlCategory = x axis
    .Axes("1").AxisTitle.Text = "Month"
    .Axes("1").AxisTitle.AutoScaleFont = True
    .Axes("1").AxisTitle.Font.Size = 8
    .Axes("2").HasTitle = True 'xlValue = y axis
    .Axes("2").AxisTitle.Text = "No. of Submission"
    .Axes("2").AxisTitle.AutoScaleFont = True
    .Axes("2").AxisTitle.Font.Size = 8
    .ChartType = xlChartType
    .PlotArea.Interior.ColorIndex = "0"
    .PlotBy = "1" '2 = Column Plot
    .SetSourceData xlApp.Worksheets("Sheet1").Range("A1","N6")
End With

实例化新的NotesUIWorkspace意味着代理不在服务器上运行。因此,您可能应该询问运行代码的其他用户计算机上的Excel版本。请注意,只有在计划代理或使用notesAgent.RunOnServer[noteID$]在服务器上运行代理时,代理才会在服务器上运行。

我更改了此行,即使服务器上没有安装excel,代理也可以正常运行。
将SetSourceData xlApp.WorksheetsSheet1.RangeA1,N6更改为SetSourceData xlApp.WorksheetsSheet1.RangeA1,N&row-1

您真的希望遇到R4客户吗?从4.6生命终结到现在已经超过8年了。图形的渲染到底有多不正确?2个问题。。您是如何调用此代码、操作按钮还是通过代理?你能说它是如何不正确地呈现的吗?你是否收到了一条错误消息?正如Hristo所指出的,你对代码在哪里运行感到困惑。即使在访问服务器上的数据库时,此代码也会传输到本地计算机并在那里执行。