ChartDataWorkbook

Inheritance: java.lang.Object, com.aspose.slides.DomObject

All Implemented Interfaces: com.aspose.slides.IChartDataWorkbook

public class ChartDataWorkbook extends DomObject<ChartData> implements IChartDataWorkbook

Provides access to embedded Excel workbook

Methods

MethodDescription
getWorksheets()Gets a collection of worksheets.
getCellCollection(String formula, boolean skipHiddenCells)Gets the set of cells.
getCell(String worksheetName, int row, int column)Gets the cell that can be used for chart series or categories
getCell(int worksheetIndex, int row, int column)Gets the cell that can be used for chart series or categories
getCell(int worksheetIndex, String cellName)Gets the cell that can be used for chart series or categories
getCell(int worksheetIndex, String cellName, Object value)Gets the cell that can be used for chart series or categories
getCell(int worksheetIndex, int row, int column, Object value)Gets the cell that can be used for chart series or categories
clear(int sheetIndex)Clear all cells values on sheet
calculateFormulas()Calculates all formulas in the workbook and updates corresponding cells values.

getWorksheets()

public final IChartDataWorksheetCollection getWorksheets()

Gets a collection of worksheets.


Example:
 
 Presentation pres = new Presentation();
 try {
     IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 50, 50, 400, 500);
     IChartDataWorkbook workbook =  chart.getChartData().getChartDataWorkbook();
     for (IChartDataWorksheet worksheet : workbook.getWorksheets())
     {
         String worksheetName = worksheet.getName();
     }
 } finally {
     if (pres != null) pres.dispose();
 }

Returns: IChartDataWorksheetCollection

getCellCollection(String formula, boolean skipHiddenCells)

public final IChartCellCollection getCellCollection(String formula, boolean skipHiddenCells)

Gets the set of cells.

Parameters:

ParameterTypeDescription
formulajava.lang.StringExcel formula like “Sheet1!$A$2:$A$5”.
skipHiddenCellsbooleanIf true then method returns collection without hidden cells.

Returns: IChartCellCollection

getCell(String worksheetName, int row, int column)

public final IChartDataCell getCell(String worksheetName, int row, int column)

Gets the cell that can be used for chart series or categories

Parameters:

ParameterTypeDescription
worksheetNamejava.lang.StringName of the worksheet.
rowintThe row.
columnintThe column.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, int row, int column)

public final IChartDataCell getCell(int worksheetIndex, int row, int column)

Gets the cell that can be used for chart series or categories

Parameters:

ParameterTypeDescription
worksheetIndexintIndex of the worksheet.
rowintThe row.
columnintThe column.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, String cellName)

public final IChartDataCell getCell(int worksheetIndex, String cellName)

Gets the cell that can be used for chart series or categories

Parameters:

ParameterTypeDescription
worksheetIndexintIndex of the worksheet.
cellNamejava.lang.StringName of the cell.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, String cellName, Object value)

public final IChartDataCell getCell(int worksheetIndex, String cellName, Object value)

Gets the cell that can be used for chart series or categories

Parameters:

ParameterTypeDescription
worksheetIndexintIndex of the worksheet.
cellNamejava.lang.StringName of the cell.
valuejava.lang.ObjectThe value.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, int row, int column, Object value)

public final IChartDataCell getCell(int worksheetIndex, int row, int column, Object value)

Gets the cell that can be used for chart series or categories

Parameters:

ParameterTypeDescription
worksheetIndexintIndex of the worksheet.
rowintThe row.
columnintThe column.
valuejava.lang.ObjectThe value.

Returns: IChartDataCell - Cell object

clear(int sheetIndex)

public final void clear(int sheetIndex)

Clear all cells values on sheet

Parameters:

ParameterTypeDescription
sheetIndexintIndex of sheet

calculateFormulas()

public final void calculateFormulas()

Calculates all formulas in the workbook and updates corresponding cells values.


Example shows how to assign a formula to the cell and to calculate a value. The value of the "B4" cell is getting set to 5.
  
  Presentation pres = new Presentation();
  try {
      IChart chart = pres.getSlides().get_Item(0).getShapes().addChart(ChartType.Pie, 100, 100, 300, 400);
      IChartDataWorkbook wb = chart.getChartData().getChartDataWorkbook();
      wb.getCell(0, "B2", 2);
      wb.getCell(0, "B3", 3);
      wb.getCell(0, "B4").setFormula("B2+B3");
      wb.calculateFormulas();
      ...
  } finally {
      if (pres != null) pres.dispose();
  }