com.aspose.cells
Class TimelineCollection

java.lang.Object
  extended by CollectionBase
      extended by com.aspose.cells.TimelineCollection
All Implemented Interfaces:
java.lang.Iterable

public class TimelineCollection 
extends CollectionBase

Specifies the collection of all the Timeline objects on the specified worksheet.

Example:

Workbook book = new Workbook();
Worksheet sheet = book.getWorksheets().get(0);
Cells cells = sheet.getCells();
cells.get(0, 0).setValue("fruit");
cells.get(1, 0).setValue("grape");
cells.get(2, 0).setValue("blueberry");
cells.get(3, 0).setValue("kiwi");
cells.get(4, 0).setValue("cherry");

//Create date style
Style dateStyle = new CellsFactory().createStyle();
dateStyle.setCustom("m/d/yyyy");
cells.get(0, 1).setValue("date");
cells.get(1, 1).setValue(new DateTime(2021, 2, 5));
cells.get(2, 1).setValue(new DateTime(2022, 3, 8));
cells.get(3, 1).setValue(new DateTime(2023, 4, 10));
cells.get(4, 1).setValue(new DateTime(2024, 5, 16));
//Set date style
cells.get(1, 1).setStyle(dateStyle);
cells.get(2, 1).setStyle(dateStyle);
cells.get(3, 1).setStyle(dateStyle);
cells.get(4, 1).setStyle(dateStyle);

cells.get(0, 2).setValue("amount");
cells.get(1, 2).setValue(50);
cells.get(2, 2).setValue(60);
cells.get(3, 2).setValue(70);
cells.get(4, 2).setValue(80);

PivotTableCollection pivots = sheet.getPivotTables();
//Add a PivotTable
int pivotIndex = pivots.add("=Sheet1!A1:C5", "A12", "TestPivotTable");
PivotTable pivot = pivots.get(pivotIndex);
pivot.addFieldToArea(PivotFieldType.ROW, "fruit");
pivot.addFieldToArea(PivotFieldType.COLUMN, "date");
pivot.addFieldToArea(PivotFieldType.DATA, "amount");
pivot.setPivotTableStyleType(PivotTableStyleType.PIVOT_TABLE_STYLE_MEDIUM_10);

//Refresh PivotTable data
pivot.refreshData();
pivot.calculateData();

//do your business
book.save("out.xlsx");


Property Getters/Setters Summary
intgetCount()→ inherited from com.aspose.cells.CollectionBase
          
Timelineget(int)
           Gets the Timeline by index.
Timelineget(java.lang.String)
           Gets the Timeline by Timeline's name.
 
Method Summary
intadd(PivotTable pivot, int row, int column, PivotField baseField)
           Add a new Timeline using PivotTable as data source
intadd(PivotTable pivot, int row, int column, int baseFieldIndex)
           Add a new Timeline using PivotTable as data source
intadd(PivotTable pivot, int row, int column, java.lang.String baseFieldName)
           Add a new Timeline using PivotTable as data source
intadd(PivotTable pivot, java.lang.String destCellName, PivotField baseField)
           Add a new Timeline using PivotTable as data source
intadd(PivotTable pivot, java.lang.String destCellName, int baseFieldIndex)
           Add a new Timeline using PivotTable as data source
intadd(PivotTable pivot, java.lang.String destCellName, java.lang.String baseFieldName)
           Add a new Timeline using PivotTable as data source
intadd(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
voidclear()→ inherited from com.aspose.cells.CollectionBase
          
booleancontains(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
intindexOf(java.lang.Object value)→ inherited from com.aspose.cells.CollectionBase
          Reserved for internal use.
java.util.Iteratoriterator()→ inherited from com.aspose.cells.CollectionBase
          
voidremoveAt(int index)→ inherited from com.aspose.cells.CollectionBase
          
 

Property Getters/Setters Detail

getCount

→ inherited from com.aspose.cells.CollectionBase
public int getCount()

get

public Timeline get(int index)
Gets the Timeline by index.

Example:

//Get the Timeline by index.
Timeline objByIndex = sheet.getTimelines().get(0);

get

public Timeline get(java.lang.String name)
Gets the Timeline by Timeline's name.

Example:

//Get the Timeline by Timeline's name.
Timeline objByName = sheet.getTimelines().get("date");

Method Detail

add

public int add(PivotTable pivot, int row, int column, java.lang.String baseFieldName)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
row - Row index of the cell in the upper-left corner of the Timeline range.
column - Column index of the cell in the upper-left corner of the Timeline range.
baseFieldName - The name of PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, 10, 5, "date");

add

public int add(PivotTable pivot, java.lang.String destCellName, java.lang.String baseFieldName)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
destCellName - The cell name in the upper-left corner of the Timeline range.
baseFieldName - The name of PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, "i15", "date");

add

public int add(PivotTable pivot, int row, int column, int baseFieldIndex)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
row - Row index of the cell in the upper-left corner of the Timeline range.
column - Column index of the cell in the upper-left corner of the Timeline range.
baseFieldIndex - The index of PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, 15, 5, 1);

add

public int add(PivotTable pivot, java.lang.String destCellName, int baseFieldIndex)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
destCellName - The cell name in the upper-left corner of the Timeline range.
baseFieldIndex - The index of PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, "i5", 1);

add

public int add(PivotTable pivot, int row, int column, PivotField baseField)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
row - Row index of the cell in the upper-left corner of the Timeline range.
column - Column index of the cell in the upper-left corner of the Timeline range.
baseField - The PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, 20, 5, pivot.getBaseFields().get(1));

add

public int add(PivotTable pivot, java.lang.String destCellName, PivotField baseField)
Add a new Timeline using PivotTable as data source
Parameters:
pivot - PivotTable object
destCellName - The cell name in the upper-left corner of the Timeline range.
baseField - The PivotField in PivotTable.BaseFields
Returns:
The new add Timeline index

Example:

//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, "i10", pivot.getBaseFields().get(1));

clear

→ inherited from com.aspose.cells.CollectionBase
public void clear()

removeAt

→ inherited from com.aspose.cells.CollectionBase
public void removeAt(int index)

iterator

→ inherited from com.aspose.cells.CollectionBase
public java.util.Iterator iterator()

contains

→ inherited from com.aspose.cells.CollectionBase
public boolean contains(java.lang.Object value)
Reserved for internal use.

add

→ inherited from com.aspose.cells.CollectionBase
public int add(java.lang.Object value)
Reserved for internal use.

indexOf

→ inherited from com.aspose.cells.CollectionBase
public int indexOf(java.lang.Object value)
Reserved for internal use.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.