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()
Returns or sets the height of the specified timeline, in pixels.
|
int |
getLeftPixel()
Returns or sets the horizontal offset of timeline shape from its left column, in pixels.
|
java.lang.String |
getName()
Returns or sets the name of the specified Timeline
|
int |
getTopPixel()
Returns or sets the vertical offset of timeline shape from its top row, in pixels.
|
int |
getWidthPixel()
Returns or sets the width of the specified timeline, in pixels.
|
void |
setCaption(java.lang.String value)
Returns or sets the caption of the specified Timeline.
|
void |
setHeightPixel(int value)
Returns or sets the height of the specified timeline, in pixels.
|
void |
setLeftPixel(int value)
Returns or sets the horizontal offset of timeline shape from its left column, in pixels.
|
void |
setName(java.lang.String value)
Returns or sets the name of the specified Timeline
|
void |
setTopPixel(int value)
Returns or sets the vertical offset of timeline shape from its top row, in pixels.
|
void |
setWidthPixel(int value)
Returns or sets the width of the specified timeline, in pixels.
|
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 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()
public void setLeftPixel(int value)
public int getTopPixel()
public void setTopPixel(int value)
public int getWidthPixel()
public void setWidthPixel(int value)
public int getHeightPixel()
public void setHeightPixel(int value)
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 2001-2023. All Rights Reserved.