渲染时间轴
Contents
[
Hide
]
可能的使用场景
Aspose.Cells支持在不使用office 2013、office 2016、office 2019和office 365的情况下呈现时间轴形状。如果将工作表转换为图像,或者将工作簿保存为PDF或HTML格式,就会看到时间轴已正确呈现。
呈现时间轴
以下示例代码加载包含现有时间轴的sample Excel file,根据时间轴名称获取形状对象,然后通过Shape.ToImage()方法将其呈现为图片。以下图片是output image,显示了已呈现的时间轴。正如你所见,时间轴已正确呈现,并且看起来与示例Excel文件中的相同。
示例代码
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
// 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); |