Build a Rich Excel Report with ZK Spreadsheet and Database"
Line 25: | Line 25: | ||
===ZUML Example=== | ===ZUML Example=== | ||
− | <source lang=" | + | <source lang="xml"> |
<window id="reportwin" apply="demo.genreport.ReportComposer" vflex="1"> | <window id="reportwin" apply="demo.genreport.ReportComposer" vflex="1"> | ||
<button label="Generate the report" onClick="reportwin$composer.generate();"/> | <button label="Generate the report" onClick="reportwin$composer.generate();"/> |
Revision as of 01:54, 19 November 2010
ZK Spreadsheet APIs support importing Excel file and exporting to PDF file, copying and pasting cells, and updating values. With all these capabilities plus versatile formula functions provided make it a perfect tool to generate a rich enterprise level report. You can either view(or even do some after editing) the report on the browser and/or print it into PDF later.
Purpose
Combine ZK Spreadsheet with a back end database to generate a rich report.
Template Excel File with Proper Styles
Construct an Excel template file with proper formulas and styles for header in ReportSheet and row in TemplateSheet.
Generate Report
Use ReportSheet as Report showing page, and TemplateSheet as Row template sheet plus some control variables.
The operation is straightforward:
- Load data list from the back-end database.
- Per the number of the retrieved data, copy row template from TemplateSheet to ReportSheet.
- Fill in data to each row on the ReportSheet.
- There you go!
ZUML Example
<window id="reportwin" apply="demo.genreport.ReportComposer" vflex="1">
<button label="Generate the report" onClick="reportwin$composer.generate();"/>
<spreadsheet id="report" src="/genreport.xls" maxrows="40" maxcolumns="8" vflex="1" width="100%"/>
</window>
Version History
Version | Date | Content |
---|---|---|
All source code listed in this book is at Github.