Setting Up ZK Spreadsheet
To enable use of ZK Spreadsheet there are few prerequisites.
Prerequisites
Installing the Libraries
Depending on your IDE the steps will differ, however the most important part is both ZK Spreadsheet and ZK’s JAR files are included in your project. The project should be a ZK Project or a Web Application Project depending on what environment you are using.
The easiest way to create a compatible project is to use ZK Studio and then include all essential library. All library be download from page [3], inside ZK Spreadsheet binary.
A Very Basic Application
Having set-up ZK and ZK Spreadsheet in the environment. We also need to prepare a Excel file as a source of the spreadsheet. Then we need to create an index.zul file. We can then place the following code into it.
<?xml version="1.0" encoding="UTF-8"?>
<zk xmlns="http://www.zkoss.org/2005/zul">
<spreadsheet src="/demo_sample.xls"
maxrows="200"
maxcolumns="40"
hflex="1"
vflex="1"></spreadsheet>
</zk>
Attributes
- src: The source file of the spreadsheet
- maxrows: The maximum number of columns of this spread sheet
- maxcolumns: The maximum number of rows of this spread sheet
- hflex and vflex: ZK's attribute, refer to [4]
This gives us our very first ZK Spreadsheet application. When the code is started, navigate to index.zul and the following page should be displayed.
Congratulations! That is all it takes to embed ZK Spreadsheet within your ZK application.
The example project is at Github