IChartDataWorkbook

public interface IChartDataWorkbook

Provides access to embedded Excel workbook

Methods

Method Description
calculateFormulas() Calculates all formulas in the workbook and updates corresponding cells values.
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
getWorksheets() Gets a collection of worksheets.

calculateFormulas()

public abstract 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();
  }

getCellCollection(String formula, boolean skipHiddenCells)

public abstract IChartCellCollection getCellCollection(String formula, boolean skipHiddenCells)

Gets the set of cells.

Parameters:

Parameter Type Description
formula java.lang.String Excel formula like “Sheet1!$A$2:$A$5”.
skipHiddenCells boolean If true then method returns collection without hidden cells.

Returns: IChartCellCollection - Set of cells IChartCellCollection

getCell(String worksheetName, int row, int column)

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

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

Parameters:

Parameter Type Description
worksheetName java.lang.String Name of the worksheet.
row int The row.
column int The column.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, int row, int column)

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

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

Parameters:

Parameter Type Description
worksheetIndex int Index of the worksheet.
row int The row.
column int The column.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, String cellName)

public abstract IChartDataCell getCell(int worksheetIndex, String cellName)

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

Parameters:

Parameter Type Description
worksheetIndex int Index of the worksheet.
cellName java.lang.String Name of the cell.

Returns: IChartDataCell - Cell object

getCell(int worksheetIndex, String cellName, Object value)

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

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

Parameters:

Parameter Type Description
worksheetIndex int Index of the worksheet.
cellName java.lang.String Name of the cell.
value java.lang.Object The value.

Returns: IChartDataCell - Cell object

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

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

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

Parameters:

Parameter Type Description
worksheetIndex int Index of the worksheet.
row int The row.
column int The column.
value java.lang.Object The value.

Returns: IChartDataCell - Cell object

clear(int sheetIndex)

public abstract void clear(int sheetIndex)

Clear all cells values on sheet

Parameters:

Parameter Type Description
sheetIndex int Index of sheet

getWorksheets()

public abstract 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