Step1:
create form and give name as “frmexcelchart” and make sure the form contains rich text field , which name is chart
step2:
create action button on which view you want to get chart…. make sure all field map in view. and put the following code in that button
Sub Click(Source As Button)
On Error Resume Next
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim view As NotesView
Dim uidoc As NotesuiDocument
Dim xlApp As Variant
Dim i As Integer
Dim j As Integer
Set view=session.CurrentDatabase.GetView(”vwStudentMark”)
Set xlApp = CreateObject(”Excel.application”)
xlApp.Visible = False
xlApp.Workbooks.Add
For i=1 To view.ColumnCount
j=1
Forall x In view.GetColumnValues(i-1)
xlapp.cells(j,i+1)=x
j=j+1
End Forall
Next
Xlapp.cells.select
Xlapp.charts.Add
Const xlLocationAsObject = 2
With xlApp.ActiveWorkbook.ActiveChart
.Name = “Student Mark system”
.HasTitle = True
.Axes(2).HasTitle = True
.Axes(2).AxisTitle.Characters.Text = “Mark”
.Axes(1).HasTitle = True
.Axes(1).AxisTitle.Characters.Text = “Student Name”
.HasLegend = True
.ChartTitle.Text = “Student Mark Chart”
.ChartType = “98″
.PlotArea.Interior.ColorIndex = “0″
.Location xlLocationAsObject, “Student Mark System” ‘move chart to worksheet
End With
xlApp.ActiveSheet.ChartObjects(”Chart 1″).Activate
xlApp.ActiveChart.ChartArea.Select
xlApp.ActiveChart.ChartArea.Copy
Set uidoc = workspace.ComposeDocument(”",”",”frmexcelchart”)
Call uidoc.GotoField(”chart”)
Call uidoc.Paste
xlApp.ActiveWorkbook.saved = True
xlApp.quit
End Sub
step3:
Save , run then click button, you can get graph
No comments:
Post a Comment