xlsgen > overview > Chart export

 

Charts can be exported individually. The following file formats are supported :

 

Exporting as PNG

When exporting a chart as a PNG file, it's calculated, rendered and then a file with a file name of your choosing is created. PNG files are well suited for report-type applications where a picture is incorporated typically in a document meant to be viewed as is or printed.


A chart exported as PNG using xlsgen

The following code snippets exports the 2nd chart for the current worksheet :

Java code

currentWorksheet.getCharts().getItem(2).ExtractAsPNG("c:\\tmp\\export.png");

VB code

currentWorksheet.Charts.Item(2).ExtractAsPNG('c:\tmp\export.png')

C# code

currentWorksheet.Charts.Item(2).ExtractAsPNG("c:\\tmp\\export.png");

C/C++ code

currentWorksheet->Charts->Item[2]->ExtractAsPNG("c:\\tmp\\export.png");

 

Exporting as SVG

When exporting a chart as a SVG file, it's calculated, rendered and then a file with a file name of your choosing is created. SVG files are well suited for web displays where the width and height may greatly vary and the chart area must adapt itself to it, hence a vector-based file format such as SVG.


A chart exported as SVG using xlsgen

The following code snippets exports the 2nd chart for the current worksheet :

Java code

currentWorksheet.getCharts().getItem(2).ExtractAsSVG("c:\\tmp\\export.svg");

VB code

currentWorksheet.Charts.Item(2).ExtractAsSVG('c:\tmp\export.svg')

C# code

currentWorksheet.Charts.Item(2).ExtractAsSVG("c:\\tmp\\export.svg");

C/C++ code

currentWorksheet->Charts->Item[2]->ExtractAsSVG("c:\\tmp\\export.svg");

 

HTML Integration

HTML export creates charts as static pictures, using PNG file format, by default. It is possible to instruct xlsgen to use SVG for charts instead. When this happens, SVG markup is embedded in the HTML stream and the resulting file can be viewed using any modern web browser.

Here is how to instruct xlsgen to use SVG for charts during HTML export :

Java code

workbook.putChartEngine(chartengine_svg);

VB code

workbook.ChartEngine = enumChartEngine.chartengine_svg

C# code

workbook.ChartEngine = enumChartEngine.chartengine_svg;

C/C++ code

workbook->ChartEngine = xlsgen::chartengine_svg;

 

xlsgen documentation. © ARsT Design all rights reserved.