渲染时间轴

可能的使用场景

Aspose.Cells支持在不使用office 2013、office 2016、office 2019和office 365的情况下呈现时间轴形状。如果将工作表转换为图像,或者将工作簿保存为PDF或HTML格式,就会看到时间轴已正确呈现。

呈现时间轴

以下示例代码加载包含现有时间轴的sample Excel file,根据时间轴名称获取形状对象,然后通过Shape.ToImage()方法将其呈现为图片。以下图片是output image,显示了已呈现的时间轴。正如你所见,时间轴已正确呈现,并且看起来与示例Excel文件中的相同。

todo:image_alt_text

示例代码

// 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);