渲染时间线
Contents
[
Hide
]
可能的使用场景
Aspose.Cells 支持在不使用 office 2013、office 2016、office 2019 和 office 365 的情况下渲染时间线形状。如果将工作表转换为图像或将工作簿保存为 PDF 或 HTML 格式,您将看到,时间线被正确渲染。
渲染时间线
下面的示例代码加载示例 Excel 文件包含一个现有的时间表。根据时间线的名称获取shape对象,然后通过Shape.ToImage()方法渲染成图片。流动的图像是输出图像显示渲染的时间线。如您所见,时间线已正确呈现,看起来与示例 Excel 文件中的一样。
示例代码
This file contains hidden or 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); |