Excel を SVG に変換する

Excel を SVG に変換する

SVG(スケーラブル ベクター グラフィックス)は、2次元ベクターグラフィックススペックであり、XML 標準に基づいています。1999 年以来、World Wide Web Consortium (W3C) によって開発されているオープンスタンダードです。

Aspose.Cells for Python via Java では、Excel ファイルを SVG 画像に変換する機能をサポートしています。そのために、API は SheetRenderImageOrPrintOptions、および WorkbookRender クラスを提供しています。

以下のコードスニペットは、Excel ワークシートを SVG 画像に変換する方法を示しています。

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")