Converti Excel in SVG

Converti Excel in SVG

SVG (Scalable Vector Graphics) è una specifica basata su standard XML per grafica vettoriale bidimensionale. È uno standard aperto che è stato in fase di sviluppo da parte del World Wide Web Consortium (W3C) dal 1999.

Aspose.Cells per Python via Java supporta la conversione di file Excel in immagini SVG. A questo scopo, l’API fornisce le classi SheetRender, ImageOrPrintOptions e WorkbookRender.

Il seguente frammento di codice dimostra la conversione di un foglio di lavoro di Excel in un’immagine 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")