タイムラインを挿入
Contents
[
Hide
]
考えられる使用シナリオ
フィルターを調整して日付を表示する代わりに、ピボットテーブル タイムラインを使用できます。これは、日付/時刻で簡単にフィルター処理し、スライダー コントロールで必要な期間を拡大できる動的フィルター オプションです。 Microsoft Excel では、ピボット テーブルを選択してから、挿入 > タイムラインJava の Aspose.Cells では、[Worksheet.getTimelines.add()] メソッドを使用してタイムラインを作成することもできます。
ピボット テーブルにタイムラインを作成する
以下のサンプルコードをご覧ください。それはサンプル Excel ファイルピボットテーブルが含まれています。次に、最初のベース ピボット フィールドに基づいてタイムラインを作成します。最後に、ワークブックを出力 XLSXフォーマット。次のスクリーンショットは、出力 Excel ファイルで Aspose.Cells によって作成されたタイムラインを示しています。

サンプルコード
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Load sample Excel file containing pivot table. | |
Workbook wb = new Workbook("input.xlsx"); | |
// Access second worksheet. | |
Worksheet sheet = wb.getWorksheets().get(1); | |
//Access PivotTable collection inside the worksheet | |
PivotTableCollection pivots = sheet.getPivotTables(); | |
// Access first pivot table | |
PivotTable pivot = pivots.get(0); | |
//Access Timeline collection inside the worksheet | |
TimelineCollection timelines = sheet.getTimelines(); | |
// Add timeline relating to pivot table | |
int index = timelines.add(pivot, 15, 1, "Ship Date"); | |
// Access the newly added timeline from timeline collection. | |
Timeline timeline = timelines.get(index); | |
wb.save("output.xlsx"); |