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