TimelineCollection
内容
[
隐藏
]TimelineCollection class
指定指定工作表上所有时间轴对象的集合。
public class TimelineCollection : CollectionBase<Timeline>
特性
姓名 | 描述 |
---|---|
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | 按索引获取时间线。 (2 indexers) |
Item { get; set; } |
方法
姓名 | 描述 |
---|---|
Add(PivotTable, string, int) | 使用数据透视表作为数据源添加新的时间线 |
Add(PivotTable, string, PivotField) | 使用数据透视表作为数据源添加新的时间线 |
Add(PivotTable, string, string) | 使用数据透视表作为数据源添加新的时间线 |
Add(PivotTable, int, int, int) | 使用数据透视表作为数据源添加新的时间线 |
Add(PivotTable, int, int, PivotField) | 使用数据透视表作为数据源添加新的时间线 |
Add(PivotTable, int, int, string) | 使用数据透视表作为数据源添加新的时间线 |
BinarySearch(Timeline) | |
BinarySearch(Timeline, IComparer<Timeline>) | |
BinarySearch(int, int, Timeline, IComparer<Timeline>) | |
Clear() | |
Contains(Timeline) | |
CopyTo(Timeline[]) | |
CopyTo(Timeline[], int) | |
CopyTo(int, Timeline[], int, int) | |
Exists(Predicate<Timeline>) | |
Find(Predicate<Timeline>) | |
FindAll(Predicate<Timeline>) | |
FindIndex(Predicate<Timeline>) | |
FindIndex(int, Predicate<Timeline>) | |
FindIndex(int, int, Predicate<Timeline>) | |
FindLast(Predicate<Timeline>) | |
FindLastIndex(Predicate<Timeline>) | |
FindLastIndex(int, Predicate<Timeline>) | |
FindLastIndex(int, int, Predicate<Timeline>) | |
GetEnumerator() | |
IndexOf(Timeline) | |
IndexOf(Timeline, int) | |
IndexOf(Timeline, int, int) | |
LastIndexOf(Timeline) | |
LastIndexOf(Timeline, int) | |
LastIndexOf(Timeline, int, int) | |
RemoveAt(int) |
例子
[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";
//创建日期样式
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);
//设置日期样式
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;
//添加数据透视表
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;
//刷新数据透视表数据
pivot.RefreshData();
pivot.CalculateData();
//做你的事
book.Save("out.xlsx");
也可以看看
- class CollectionBase<T>
- class Timeline
- 命名空间 Aspose.Cells.Timelines
- 部件 Aspose.Cells