Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Insert Excel Chart in Word
Message
 
 
To
21/07/2011 11:01:03
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01518504
Message ID:
01518781
Views:
35
loXL.Height = loXL.Height * 1.2
loXL.Width = loXL.Width * 1.2
>Here's the sample code:
>
>
LOCAL loxl as EXCEL.Application
>
>m.loxl = CREATEOBJECT("Excel.application")
>m.loXLWorkbook = m.loxl.Workbooks.Add()
>m.loxl.Visible = .t.
>
>m.loXL.ActiveSheet.Cells[1,1].VALUE = "Month"
>m.loXL.ActiveSheet.Cells[2,1].VALUE = "Jan"
>m.loXL.ActiveSheet.Cells[3,1].VALUE = "Feb"
>m.loXL.ActiveSheet.Cells[4,1].VALUE = "Mar"
>m.loXL.ActiveSheet.Cells[5,1].VALUE = "Apr"
>m.loXL.ActiveSheet.Cells[6,1].VALUE = "May"
>
>m.loXL.ActiveSheet.Cells[1,2].VALUE = "Claims"
>m.loXL.ActiveSheet.Cells[1,3].VALUE = "Turnaround"
>
>FOR i = 2 TO 6
>	m.loXL.ActiveSheet.Cells[m.i,2].VALUE = m.i * 10
>	m.loXL.ActiveSheet.Cells[m.i,3].VALUE = m.i - 1
>ENDFOR
>m.loSourceRange = m.loXL.Range("A1:C6")
>m.loSourceRange.Select()
>
>xlBuiltIn = 21
>xlColumns = 2
>xlLocationAsObject = 2
>xlCategory = 1
>xlPrimary = 1
>xlValue = 2
>xlSecondary = 2
>xlUp = -4162
>xl3DPie = -4102
>xlLineMarkers = 65
>xlLocationAsNewSheet = 1
>
>m.loChart = m.loXLWorkbook.Charts.Add()
>
>				
>*!*	m.loChart.ChartWizard(m.loSourceRange,  -4102, 4 , 2, 1, 0, .T., [Claims Received/Turnaround])
>m.loChart.ApplyCustomType(xlBuiltIn, "Lines on 2 Axes")
>m.loChart.HasTitle = .t.
>m.loChart.ChartTitle.Characters.Text = "Claims Received/Turnaround"
>m.loChart.Axes(xlCategory, xlPrimary).HasTitle = .T.
>m.loChart.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Month"
>m.loChart.Axes(xlValue, xlPrimary).HasTitle = .T.
>m.loChart.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Claims Received"
>m.loChart.Axes(xlCategory, xlSecondary).HasTitle = .T.
>m.loChart.Axes(xlCategory, xlSecondary).AxisTitle.Characters.Text = ""
>m.loChart.Axes(xlValue, xlSecondary).HasTitle = .T.
>m.loChart.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "Avg. Turnaround"
>
>With m.loChart.Axes(xlCategory)
>    .HasMajorGridlines = .F.
>    .HasMinorGridlines = .F.
>EndWith
>With m.loChart.Axes(xlValue)
>    .HasMajorGridlines = .T.
>    .HasMinorGridlines = .F.
>ENDWITH
>FOR j = 1 TO m.loXL.ActiveSheet.Shapes.Count
>	If m.loXL.ActiveSheet.Shapes(j).Type = msoChart Then
>		m.loXL.ActiveSheet.Shapes(j).Width = 4 * 72
>		m.loXL.ActiveSheet.Shapes(j).Height = 3 * 72
>	EndIf
>ENDFOR 
>m.loChart.Location(xlLocationAsNewSheet)
>m.loXL.Visible = .T.
>
>
>The code would never go into the FOR loop.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform