服务器中的图形呈现不正确 [英] Graph rendering in the server is incorrect

查看:88
本文介绍了服务器中的图形呈现不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在开发服务器(Notes客户端)中部署了一个应用程序.该应用程序包含一个功能,可将用户本地计算机中的数据与图形生成一起导出.我的问题是,当导出数据时,图形的渲染不正确(在服务器中),但是当我在本地计算机上运行图形时,图形的渲染很好. 我在本地计算机上使用了MS 2007,但在开发服务器中未安装MS Office,是否可以执行此操作?这是下面的代码.

I have an application deployed in the development server (notes client). The application composed a function to export the data in the local machine of the user along with the graph generation. My problem is, when the data are exported, the rendering of graph is incorrect (in the server), but when I run it in my local machine the graph rendering is fine. I used MS 2007 in my local machine but in the development server there is NO MS Office installed.Is there any way to do this? Here is the code below.

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

推荐答案

我更改了此行,即使服务器上未安装excel,它也能正常工作. 将SetSourceData xlApp.Worksheets("Sheet1").Range("A1","N6")更改为SetSourceData xlApp.Worksheets("Sheet1").Range("A1","N"& row-1)

I changed this line and it works fine even there is no excel installed on the server. change SetSourceData xlApp.Worksheets("Sheet1").Range("A1","N6") to SetSourceData xlApp.Worksheets("Sheet1").Range("A1","N" & row-1)

这篇关于服务器中的图形呈现不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆