Message-ID: <1847857860.9453.1711691477192.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9452_1301224123.1711691477192" ------=_Part_9452_1301224123.1711691477192 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Chartsheet
object represents a worksheet that contains only a =
chart.=20
public sealed class Chartsheet : Worksheet=20
Public NotInheritable Class Chartsheet =09=09Inherits Worksheet=20
To create a Chartsheet
, use Worksheets.createChartsheet() or=
Chart.MoveChart(=
). To get an existing Chartsheet
, get a Worksheet using Workbook.Worksheets[i] =
and check if it is of type Chartsheet
.
Anchors behave slig= htly differently on Chartsheets than on regular worksheets. When creating a= n anchor, the row and column properties are ignored. The OffsetX and Offset= Y properties specify a percentage value, with 0 corresponding to the left o= r top edge, and 100 corresponding to the bottom or right edge of the Charts= heet. This allows you to add a shape or picture to an arbitrary position on= the Chartsheet.
Similarly, the Width and Height properties on Shapes, Pictures, and Grou= ps specify a percentage of the total width or height of the chartsheet. So = a Shape with a width of 25 would occupy 25% of the Chartsheet.
You can have as many Shape, Pictures, and Groups as you wish on the char= tsheet. However, you may only have one chart on the chartsheet, which is sp= ecified with the Chart property.
Some Worksheet p= roperties are not valid on a Chartsheet.
The following table summarizes the behavior of Worksheet properties on C= hartsheets. If you try to access or set a property on a Chartsheet that is = not valid, an InvalidOperationException will be thrown. Some properties wil= l behave as AutoProperties, but will have no effect in the saved file. If t= he property is supported but there are differences in behavior from Workshe= ets, the differences are described in the Notes column.
Property or method is not valid on Chartsheets, and will throw an I=
nvalidOperationException
Property or method is fully supported on C=
hartsheets
Property behaves as an autoproperty, but will h=
ave no effect on the resulting file.
Property |
Valid on Chartsheet |
Notes |
---|---|---|
Returns a Cells object, but using any methods or properties on the = object will throw an InvalidOperationException. |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Returns an empty enumeration |
||
Returns a ChartPageSetup object |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
Returns SheetViewState.Normal. Setting it to = a different value with throw an InvalidOperationException. |
||
|
||
Defaults to 120% |
Method |
Valid on Chartsheet |
Notes |
---|---|---|
|
||
|
||
|
||
The row and column properties will be ignored= . The offset properties should specify a percentage of the entire chartshee= t. |
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
//--- Create a Chartsheet ExcelApplication xla =3D new ExcelApplication(); Workbook wb =3D xla.Create(); Worksheet ws =3D wb.Worksheets[0]; Chartsheet cs =3D wb.Worksheets.CreateChartsheet (ChartType.Pie.Pie3D, "Chart"); //--- Get the first Chartsheet from a Workbook ExcelApplication xla =3D new ExcelApplication(); Workbook wb =3D xla.Open("C:\\MySpreadsheet.xls"); bool found =3D false; for(int i =3D 0; i < wb.Worksheets.Count; i++) { if (found =3D=3D false) { Worksheet ws =3D wb.Worksheets[i]; =20 if(ws is Chartsheet) { Chartsheet cs =3D (Chartsheet)ws; found =3D true; } } }=20
'--- Create a Chartsheet Dim xla As New ExcelApplication() Dim wb As Workbook =3D xla.Create() Dim ws As Worksheet =3D wb.Worksheets(0) Dim cs As Chartsheet =3D wb.Worksheets.CreateChartsheet _ (ChartType.Pie.Pie3D, "Chart") '--- Get the first Chartsheet from a Workbook Dim xla As New ExcelApplication() Dim wb As Workbook =3D xla.Open("C:\MySpreadsheet.xls") Dim found As Boolean =3D False Dim i As Integer For i =3D 0 To wb.Worksheets.Count - 1 If found =3D False Then Dim ws As Worksheet =3D wb.Worksheets(i) If ws Is Chartsheet Then Dim cs As Chartsheet =3D CType(ws, Chartsheet) found =3D True End If End If Next=20