Class Timeline

Class Timeline

Namespace: Aspose.Cells.Timelines
Assembly: Aspose.Cells.dll (25.2.0)

Summary description of Timeline View Due to MS Excel, Excel 2003 does not support Timeline

public class Timeline

Inheritance

objectTimeline

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[C#]
Workbook book = new Workbook();
Worksheet sheet = book.Worksheets[0];
Cells cells = sheet.Cells;
cells[0, 0].Value = "fruit";
cells[1, 0].Value = "grape";
cells[2, 0].Value = "blueberry";
cells[3, 0].Value = "kiwi";
cells[4, 0].Value = "cherry";

//Create date style
Style dateStyle = new CellsFactory().CreateStyle();
dateStyle.Custom = "m/d/yyyy";
cells[0, 1].Value = "date";
cells[1, 1].Value = new DateTime(2021, 2, 5);
cells[2, 1].Value = new DateTime(2022, 3, 8);
cells[3, 1].Value = new DateTime(2023, 4, 10);
cells[4, 1].Value = new DateTime(2024, 5, 16);
//Set date style
cells[1, 1].SetStyle(dateStyle);
cells[2, 1].SetStyle(dateStyle);
cells[3, 1].SetStyle(dateStyle);
cells[4, 1].SetStyle(dateStyle);

cells[0, 2].Value = "amount";
cells[1, 2].Value = 50;
cells[2, 2].Value = 60;
cells[3, 2].Value = 70;
cells[4, 2].Value = 80;

PivotTableCollection pivots = sheet.PivotTables;
//Add a PivotTable
int pivotIndex = pivots.Add("=Sheet1!A1:C5", "A12", "TestPivotTable");
PivotTable pivot = pivots[pivotIndex];
pivot.AddFieldToArea(PivotFieldType.Row, "fruit");
pivot.AddFieldToArea(PivotFieldType.Column, "date");
pivot.AddFieldToArea(PivotFieldType.Data, "amount");
pivot.PivotTableStyleType = PivotTableStyleType.PivotTableStyleMedium10;

//Refresh PivotTable data
pivot.RefreshData();
pivot.CalculateData();

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

//Get Timeline object
Timeline timelineObj = sheet.Timelines[0];

//do your business

book.Save("out.xlsx");

Properties

Caption

Returns or sets the caption of the specified Timeline.

public string Caption { get; set; }

Property Value

string

Examples

csharp
[C#]

//Set the caption of the specified Timeline.
timelineObj.Caption = "timeline caption test";

HeightPixel

Returns or sets the height of the specified timeline, in pixels.

public int HeightPixel { get; set; }

Property Value

int

LeftPixel

Returns or sets the horizontal offset of timeline shape from its left column, in pixels.

public int LeftPixel { get; set; }

Property Value

int

Name

Returns or sets the name of the specified Timeline

public string Name { get; set; }

Property Value

string

Examples

csharp
[C#]

//Set the name of the specified Timeline.
timelineObj.Name = "timeline name test";

TopPixel

Returns or sets the vertical offset of timeline shape from its top row, in pixels.

public int TopPixel { get; set; }

Property Value

int

WidthPixel

Returns or sets the width of the specified timeline, in pixels.

public int WidthPixel { get; set; }

Property Value

int