Conversion de graphique en image au format SVG

Contents
[ ]

Le code d’exemple suivant explique comment utiliser Aspose.Cells pour Python via .NET pour convertir un graphique en une image au format SVG. Le code charge le fichier Microsoft Excel source, puis enregistre le premier graphique trouvé sur la première feuille de calcul au format 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)