Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.7.1
ASP/COM Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelApplication > Objects > Charts

ExcelApplication is not
available in ExcelWriterSE.

The Charts Object (ICharts)

The Charts object represents the set of all charts in a single worksheet.

To create a Charts object, use,

Set Charts = ws.charts

Charts Methods and Properties

Charts Methods and Properties

Add

Adds a chart to an Excel worksheet.

Consult Chart Codes to select ChartType (pie, column, etc.) and SubType(default 0). UpperLeftRow(default 0), UpperLeftColumn(default 0), LowerRightRow(default 10), and LowerRightColumn(default 10) determine the position of the chart in your spreadsheet. The following example will generate a 3D pie chart with the upper left corner at row 3, column 0 (A), and the lower right corner at row 15, column 7 (G).


[VBScript]
Function Add(Type As ASXChartType, _
[Subtype As Integer], _
[UpperLeftRow As Long], _
[UpperLeftColumn As Long], _
[LowerRightRow As Long = 10], _
[LowerRightColumn As Long = 10]) As IChart


Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference
'--- to the ICharts object for the first worksheet
Dim XlwApp, ChartsCollection
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set ChartsCollection = XlwApp.Worksheets(1).Charts

'--- Add a new stacked column chart to the worksheet
'--- The chart's upper left corner will be in B2, 
'--- the lower right corner will be on J10
ChartsCollection.Add saxlsColumnChart, 0, 2, 2, 10, 10


Top

Count

Counts the number of charts in a worksheet. To retrieve the number of charts included in a worksheet, use,


[VBScript]
Property Count As Integer (read-only)


Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference
'--- to the SACharts object for the first worksheet
Dim XlwApp, ChartsCollection, ChartCount
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set ChartsCollection = XlwApp.Worksheets(1).Charts

'--- Get a count of the number of charts on the worksheet
ChartCount = ChartsCollection.Count


Top

Item

Represents a single chart in a Charts collection. Item is the default property of Charts, so Charts(1) is equivalent to Charts.Item(1). This collection is 1-based.

 
[VBScript]
In VBScript, this is the default property for the Charts object.

Property Item(ChartNum) As IChart

Example:



[VBScript]

'--- Create an instance of ExcelWriter and get a reference
'--- to the SACharts object for the first worksheet
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)

'--- Use the default Item property to access a 
'--- specific chart in the collection
'--- Get the second chart
Set MyChart = WrkSht.Charts(2)


Top





Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.