Example:
# Instantiating a Workbook object workbook = Workbook() # Adding a new worksheet to the Excel object sheetIndex = workbook.getWorksheets().add() # Obtaining the reference of the newly added worksheet by passing its sheet index worksheet = workbook.getWorksheets().get(sheetIndex) # Adding a sample value to "A1" cell worksheet.getCells().get("A1").putValue(50) # Adding a sample value to "A2" cell worksheet.getCells().get("A2").putValue(100) # Adding a sample value to "A3" cell worksheet.getCells().get("A3").putValue(150) # Adding a sample value to "A4" cell worksheet.getCells().get("A4").putValue(200) # Adding a sample value to "B1" cell worksheet.getCells().get("B1").putValue(60) # Adding a sample value to "B2" cell worksheet.getCells().get("B2").putValue(32) # Adding a sample value to "B3" cell worksheet.getCells().get("B3").putValue(50) # Adding a sample value to "B4" cell worksheet.getCells().get("B4").putValue(40) # Adding a sample value to "C1" cell as category data worksheet.getCells().get("C1").putValue("Q1") # Adding a sample value to "C2" cell as category data worksheet.getCells().get("C2").putValue("Q2") # Adding a sample value to "C3" cell as category data worksheet.getCells().get("C3").putValue("Y1") # Adding a sample value to "C4" cell as category data worksheet.getCells().get("C4").putValue("Y2") # Adding a chart to the worksheet chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 5, 0, 15, 5) # Accessing the instance of the newly added chart chart = worksheet.getCharts().get(chartIndex) # Adding NSeries (chart data source) to the chart ranging from "A1" cell to "B4" chart.getNSeries().add("A1:B4", True) # Setting the data source for the category data of NSeries chart.getNSeries().setCategoryData("C1:C4") # Saving the Excel file workbook.save("Book1.xls")
Property Getters/Setters Summary | ||
---|---|---|
method | getCategoryData() | |
method | setCategoryData(value) | |
Gets or sets the range of category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). | ||
method | getCount() | |
method | isColorVaried() | |
method | setColorVaried(value) | |
Represents if the color of points is varied. | ||
method | getSecondCategoryData() | |
method | setSecondCategoryData(value) | |
Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis. | ||
method | getSecondCatergoryData() | |
method | setSecondCatergoryData(value) | |
Gets or sets the range of second category Axis values. It can be a range of cells (such as, "d1:e10"), or a sequence of values (such as,"{2,6,8,10}"). Only effects when some ASerieses plot on the second axis. | ||
method | get(index) | |
Gets the |
Method Summary | ||
---|---|---|
method | add(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | add(area, isVertical) | |
Adds the |
||
method | addR1C1(area, isVertical) | |
Adds the |
||
method | changeSeriesOrder(sourceIndex, destIndex) | |
Directly chanages the orders of the two series. | ||
method | clear() | |
Clears the collection | ||
method | contains(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | get(index) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | getSeriesByOrder(order) | |
Gets the |
||
method | indexOf(value) | → inherited from CollectionBase |
Reserved for internal use. | ||
method | iterator() | → inherited from CollectionBase |
method | removeAt(index) | |
Remove at a series at the specific index. |
Property Getters/Setters Detail |
---|
getCategoryData/setCategoryData : String | |
String getCategoryData() / setCategoryData(value) |
getSecondCatergoryData/setSecondCatergoryData : String | |
String getSecondCatergoryData() / setSecondCatergoryData(value) |
getSecondCategoryData/setSecondCategoryData : String | |
String getSecondCategoryData() / setSecondCategoryData(value) |
isColorVaried/setColorVaried : boolean | |
boolean isColorVaried() / setColorVaried(value) |
getCount : int | |
int getCount() |
get : Series | |
Series get(index) |
index
- The zero based index of the element.Method Detail |
---|
getSeriesByOrder | |
Series getSeriesByOrder(order) |
order: int
- The order of seriesremoveAt | |
removeAt(index) |
index: int
- The index.changeSeriesOrder | |
changeSeriesOrder(sourceIndex, destIndex) |
sourceIndex: int
- The current indexdestIndex: int
- The dest indexaddR1C1 | |
int addR1C1(area, isVertical) |
area: String
- Specifies values from which to plot the data seriesisVertical: boolean
- Specifies whether to plot the series from a range of cell values by row or by column.add | |
int add(area, isVertical) |
area: String
- Specifies values from which to plot the data seriesisVertical: boolean
- Specifies whether to plot the series from a range of cell values by row or by column.clear | |
clear() |
iterator | |
Iterator iterator() |
get | |
Object get(index) |
contains | |
boolean contains(value) |
add | |
int add(value) |
indexOf | |
int indexOf(value) |