public class Timeline
extends java.lang.Object
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();
//Add a new Timeline using PivotTable as data source
sheet.getTimelines().add(pivot, 10, 5, "date");
//Get Timeline object
Timeline timelineObj = sheet.getTimelines().get(0);
//do your business
book.save("out.xlsx");
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getCaption()
Returns or sets the caption of the specified Timeline.
|
int |
getHeightPixel()
Deprecated.
Use Shape.Height property instead.
|
int |
getLeftPixel()
Deprecated.
Use Shape.Left property instead.
|
java.lang.String |
getName()
Returns or sets the name of the specified Timeline
|
TimelineShape |
getShape()
Returns the
TimelineShape object associated with this Timeline. |
int |
getTopPixel()
Deprecated.
Use Shape.Top property instead.
|
int |
getWidthPixel()
Deprecated.
Use Shape.Width property instead.
|
void |
setCaption(java.lang.String value)
Returns or sets the caption of the specified Timeline.
|
void |
setHeightPixel(int value)
Deprecated.
Use Shape.Height property instead.
|
void |
setLeftPixel(int value)
Deprecated.
Use Shape.Left property instead.
|
void |
setName(java.lang.String value)
Returns or sets the name of the specified Timeline
|
void |
setTopPixel(int value)
Deprecated.
Use Shape.Top property instead.
|
void |
setWidthPixel(int value)
Deprecated.
Use Shape.Width property instead.
|
public java.lang.String getCaption()
Example
//Set the caption of the specified Timeline.
timelineObj.setCaption("timeline caption test");
public void setCaption(java.lang.String value)
public TimelineShape getShape()
TimelineShape object associated with this Timeline. Read-only.public java.lang.String getName()
Example
//Set the name of the specified Timeline.
timelineObj.setName("timeline name test");
public void setName(java.lang.String value)
public int getLeftPixel()
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Left property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public void setLeftPixel(int value)
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Left property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public int getTopPixel()
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Top property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public void setTopPixel(int value)
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Top property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public int getWidthPixel()
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Width property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public void setWidthPixel(int value)
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Width property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public int getHeightPixel()
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Height property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.public void setHeightPixel(int value)
Remarks
NOTE: This member is now obsolete. Instead, please use Shape.Height property. This property will be removed 12 months later since May 2025. Aspose apologizes for any inconvenience you may have experienced.See Also:
Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
Aspose.Cells Support Forum - our preferred method of support.
We guarantee a prompt response to any inquiry!
© Aspose Pty Ltd 2003-2025. All Rights Reserved.