タイムラインのレンダリング
可能な使用シナリオ
Aspose.Cellsは、Office 2013、Office 2016、Office 2019、Office 365を使用せずにタイムラインの形状をレンダリングすることをサポートしています。ワークシートを画像に変換したり、ワークブックをPDFやHTML形式で保存すると、タイムラインが適切にレンダリングされます。
タイムラインのレンダリング
以下のサンプルコードは、既存のタイムラインを含むサンプルExcelファイルをロードします。その後、タイムラインの名前に応じてシェイプオブジェクトを取得し、Shape.ToImage()メソッドを使用して画像にレンダリングします。以下の画像は、レンダリングされたタイムラインを示す出力画像です。タイムラインが適切にレンダリングされており、サンプルExcelファイルと同じように見えます。
サンプルコード
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// Load sample Excel file containing timeline. | |
Workbook wb = new Workbook("input.xlsx"); | |
// Access second worksheet. | |
Worksheet sheet = wb.getWorksheets().get(1); | |
// Access the first Timeline inside the worksheet. | |
Timeline timeline = sheet.getTimelines().get(0); | |
ImageOrPrintOptions options = new ImageOrPrintOptions(); | |
options.setImageType(ImageType.PNG); | |
// Get timeline shape object by timeline's name | |
Shape timeLineShape = sheet.getShapes().get(timeline.getName()); | |
timeLineShape.toImage("out.png", options); |