Conversione del grafico in un immagine nel formato SVG

Contents
[ ]

Il seguente codice di esempio spiega come utilizzare Aspose.Cells for Python via .NET per convertire un grafico in un’immagine in formato SVG. Il codice carica il file di origine di Microsoft Excel e quindi salva il primo grafico trovato nel primo foglio di lavoro in SVG.

from aspose.cells import Workbook
from aspose.cells.drawing import ImageType
from aspose.cells.rendering import ImageOrPrintOptions
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Create workbook object from source file
workbook = Workbook(dataDir + "SampleChartBook.xlsx")
# Access first worksheet
worksheet = workbook.worksheets[0]
# Access first chart inside the worksheet
chart = worksheet.charts[0]
# Set image or print options
opts = ImageOrPrintOptions()
opts.image_type = ImageType.SVG
# Save the chart to svg format
chart.to_image(dataDir + "Image_out.svg", opts)