Class TimelineCollection

Class TimelineCollection

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

Specifies the collection of all the Timeline objects on the specified worksheet. Due to MS Excel, Excel 2003 does not support Timeline.

public class TimelineCollection : CollectionBase<timeline>, IList<timeline>, ICollection<timeline>, IEnumerable<timeline>, ICollection, IEnumerable

Inheritance

objectCollectionBase<timeline>TimelineCollection

Implements

IList<timeline>, ICollection<timeline>, IEnumerable<timeline>, ICollection, IEnumerable

Inherited Members

CollectionBase<timeline>.BinarySearch(Timeline), CollectionBase<timeline>.BinarySearch(Timeline, IComparer<timeline>), CollectionBase<timeline>.BinarySearch(int, int, Timeline, IComparer<timeline>), CollectionBase<timeline>.Contains(Timeline), CollectionBase<timeline>.CopyTo(Timeline[]), CollectionBase<timeline>.CopyTo(Timeline[], int), CollectionBase<timeline>.CopyTo(int, Timeline[], int, int), CollectionBase<timeline>.Exists(Predicate<timeline>), CollectionBase<timeline>.Find(Predicate<timeline>), CollectionBase<timeline>.FindAll(Predicate<timeline>), CollectionBase<timeline>.FindIndex(Predicate<timeline>), CollectionBase<timeline>.FindIndex(int, Predicate<timeline>), CollectionBase<timeline>.FindIndex(int, int, Predicate<timeline>), CollectionBase<timeline>.FindLast(Predicate<timeline>), CollectionBase<timeline>.FindLastIndex(Predicate<timeline>), CollectionBase<timeline>.FindLastIndex(int, Predicate<timeline>), CollectionBase<timeline>.FindLastIndex(int, int, Predicate<timeline>), CollectionBase<timeline>.IndexOf(Timeline), CollectionBase<timeline>.IndexOf(Timeline, int), CollectionBase<timeline>.IndexOf(Timeline, int, int), CollectionBase<timeline>.LastIndexOf(Timeline), CollectionBase<timeline>.LastIndexOf(Timeline, int), CollectionBase<timeline>.LastIndexOf(Timeline, int, int), CollectionBase<timeline>.GetEnumerator(), CollectionBase<timeline>.Clear(), CollectionBase<timeline>.RemoveAt(int), CollectionBase<timeline>.OnClearComplete(), CollectionBase<timeline>.OnClear(), CollectionBase<timeline>.Capacity, CollectionBase<timeline>.Count, CollectionBase<timeline>.InnerList, CollectionBase<timeline>.this[int], 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();

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

Properties

this[int]

Gets the Timeline by index.

public Timeline this[int index] { get; }

Property Value

Timeline

Examples

csharp
[C#]

//Get the Timeline by index.
Timeline objByIndex = sheet.Timelines[0];

this[string]

Gets the Timeline by Timeline’s name.

public Timeline this[string name] { get; }

Property Value

Timeline

Examples

csharp
[C#]

//Get the Timeline by Timeline's name.
Timeline objByName = sheet.Timelines["date"];

Methods

Add(PivotTable, int, int, string)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, int row, int column, string baseFieldName)

Parameters

pivot PivotTable

PivotTable object

row int

Row index of the cell in the upper-left corner of the Timeline range.

column int

Column index of the cell in the upper-left corner of the Timeline range.

baseFieldName string

The name of PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

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

Add(PivotTable, string, string)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, string destCellName, string baseFieldName)

Parameters

pivot PivotTable

PivotTable object

destCellName string

The cell name in the upper-left corner of the Timeline range.

baseFieldName string

The name of PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

csharp
[C#]
//Add a new Timeline using PivotTable as data source
sheet.Timelines.Add(pivot, "i15", "date");

Add(PivotTable, int, int, int)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, int row, int column, int baseFieldIndex)

Parameters

pivot PivotTable

PivotTable object

row int

Row index of the cell in the upper-left corner of the Timeline range.

column int

Column index of the cell in the upper-left corner of the Timeline range.

baseFieldIndex int

The index of PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

csharp
[C#]
//Add a new Timeline using PivotTable as data source
sheet.Timelines.Add(pivot, 15, 5, 1);

Add(PivotTable, string, int)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, string destCellName, int baseFieldIndex)

Parameters

pivot PivotTable

PivotTable object

destCellName string

The cell name in the upper-left corner of the Timeline range.

baseFieldIndex int

The index of PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

csharp
[C#]
//Add a new Timeline using PivotTable as data source
sheet.Timelines.Add(pivot, "i5", 1);

Add(PivotTable, int, int, PivotField)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, int row, int column, PivotField baseField)

Parameters

pivot PivotTable

PivotTable object

row int

Row index of the cell in the upper-left corner of the Timeline range.

column int

Column index of the cell in the upper-left corner of the Timeline range.

baseField PivotField

The PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

csharp
[C#]
//Add a new Timeline using PivotTable as data source
sheet.Timelines.Add(pivot, 20, 5, pivot.BaseFields[1]);

Add(PivotTable, string, PivotField)

Add a new Timeline using PivotTable as data source

public int Add(PivotTable pivot, string destCellName, PivotField baseField)

Parameters

pivot PivotTable

PivotTable object

destCellName string

The cell name in the upper-left corner of the Timeline range.

baseField PivotField

The PivotField in PivotTable.BaseFields

Returns

int

The new add Timeline index

Examples

csharp
[C#]
//Add a new Timeline using PivotTable as data source
sheet.Timelines.Add(pivot, "i10", pivot.BaseFields[1]);

</timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline></timeline>