Export"

From Documentation
m
m
Line 3: Line 3:
 
You can export the computed result of Pivottable to other formats.
 
You can export the computed result of Pivottable to other formats.
  
 +
==Export to Microsoft Excel==
 +
 +
Given a Pivottable instance, you can dump the current result in .xls format to an OutputStream. The exported Excel file contains a sheet that reflects the computed result you see on browser windows, without paging. For example,
 +
 +
<source lang="java">
 +
ByteArrayOutputStream out = new ByteArrayOutputStream();
 +
PivotExportContext context = Exports.getExportContext(pivot, false, null);
 +
Exports.exportExcel(out, "xls", context, null); // writes Pivottable information to the output stream
 +
Filedownload.save(out.toByteArray(), "text/csv", "pivot.csv"); // file download
 +
try {
 +
out.close();
 +
} catch (IOException e) {}
 +
</source>
 +
 +
===PivotExportContext===
 +
 +
PivotExportContext is an intermediate result for exporting Pivottable to a table/sheet data structure. You can construct it from a Pivottable, or from a PivotModel and a PivotRenderer (so you don't need a component instance).
 +
 +
 +
&nbsp;
 
==Export to CSV==
 
==Export to CSV==
 
==Export to Microsoft Excel==
 
  
 
==Version History==
 
==Version History==

Revision as of 04:59, 13 March 2012


You can export the computed result of Pivottable to other formats.

Export to Microsoft Excel

Given a Pivottable instance, you can dump the current result in .xls format to an OutputStream. The exported Excel file contains a sheet that reflects the computed result you see on browser windows, without paging. For example,

ByteArrayOutputStream out = new ByteArrayOutputStream();
PivotExportContext context = Exports.getExportContext(pivot, false, null);
Exports.exportExcel(out, "xls", context, null); // writes Pivottable information to the output stream
Filedownload.save(out.toByteArray(), "text/csv", "pivot.csv"); // file download
try {
	out.close();
} catch (IOException e) {}

PivotExportContext

PivotExportContext is an intermediate result for exporting Pivottable to a table/sheet data structure. You can construct it from a Pivottable, or from a PivotModel and a PivotRenderer (so you don't need a component instance).


 

Export to CSV

Version History

Last Update : 2012/03/13


Version Date Content
     



Last Update : 2012/03/13

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.