Change the Style of Spreadsheet within 1 Min
Ivan Cheng,
Engineer, Potix Corporation
April 25, 2008
Version
Applicable to ZK 3.0.5 and later
Applicable to ZK Spreadsheet 1.0.0 and later
Introduction
In Use JavaBean in Excel with ZK Spreadsheet, we demonstrate how to use JavaBean directly via Variable-Resolver. In this article, we will introduce another practical application about how to change the style of spreadsheet with ease. No modification of data model is required. In the following paragraphs, I will show you how to change the style of spreadsheet.
If you'd like to know more about ZK Spreadsheet, please refer to the following URLs:
- New Features of ZK Spreadsheet 0.7.0
- A Preview of ZK Spreadsheet Component
- A Sip of the ZK Spreadsheet Component
- How to Build a Rich Excel Report with ZK Spreadsheet
If you'd like to know more about Variable-Resolver, please refer to the following URL:
Let's start to build an application for calculating balance sheet with Variable-Resolver.
Live Demo
How to Build a Template Using Excel
Design a New Layout Template in Excel
NewSheet.xls
Define External Variable
Input bean and its data names NewSheet.xls, such as dataBean.item, dataBean.liquidAssets, dataBean.fundInvestment etc.
NewSheet.xls
Change the Style of Spreadsheet
sheet.zul
...... <listbox id="style" mold="select" rows="1" onSelect="changeStyle()"> <listitem label="Style 1" value="/BalanceSheet.xls"/> <listitem label="Style 2" value="/NewSheet.xls"/> </listbox> ...... void changeStyle() { //Change the URL of spreadsheet balance.url = style.getSelectedItem().value; } ...... <spreadsheet id="balance" url="/BalanceSheet.xls" maxrow="40" maxcolumn="20" height="600px" width="1300px"/> ......
Download
ZssChangeStyle.war
Conclusion
It becomes more convenient to integrate server side resource by binding Java Bean with spreadsheet. This feature simplifies developer's job to meet the user's requirement of style. In the near future, we will introduce more useful tools of ZK Spreadsheet. We expect your response to make it better, feel free to leave a message or post it to ZK forum .










