将Excel转换为SVG
Contents
[
Hide
]
将Excel转换为SVG
SVG(可缩放矢量图形)是基于XML标准的二维矢量图形规范。它是一项由万维网联盟(W3C)自1999年以来一直在开发的开放标准。
Aspose.Cells for Python via Java支持将Excel文件转换为SVG图像。为此,API提供了SheetRender、ImageOrPrintOptions和WorkbookRender类。
以下代码片段演示了将Excel工作表转换为SVG图像。
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
source_directory = "Examples/SampleFiles/SourceDirectory/" | |
output_directory = "Examples/SampleFiles/OutputDirectory/" | |
workbook = Workbook(source_directory + "Book1.xlsx") | |
imgOptions = ImageOrPrintOptions() | |
imgOptions.setSaveFormat(SaveFormat.SVG) | |
sheetCount = workbook.getWorksheets().getCount() | |
for i in range(0, sheetCount): | |
sheet = workbook.getWorksheets().get(i) | |
sr = SheetRender(sheet, imgOptions) | |
for j in range(0, sr.getPageCount()): | |
sr.toImage(j, output_directory + sheet.getName() + "%s" % j + "_out.svg") |