Set Dimension of the Sheet"
From Documentation
m (→Select sheet) |
m |
||
Line 42: | Line 42: | ||
</source> | </source> | ||
+ | [[File:ZKSsEss_Spreadsheet_DimSheet_Select.png]] | ||
===Select sheet=== | ===Select sheet=== | ||
Select sheet by Spreadsheet.setSelectedSheet() | Select sheet by Spreadsheet.setSelectedSheet() | ||
Line 50: | Line 51: | ||
</source> | </source> | ||
+ | [[File:ZKSsEss_Spreadsheet_DimSheet_Result.png]] | ||
=Version History= | =Version History= | ||
{{LastUpdated}} | {{LastUpdated}} |
Revision as of 11:50, 18 November 2010
ZK Spreadsheet can switch different sheet using Spreadsheet.setSelectedSheet();
Scenario
We use combobox to represent different sheets, user can click on it and select sheet.
ZUML Example
<zk>
<div height="100%" width="100%" apply="demo.SheetsComposer">
<combobox id="sheets"></combobox>
<spreadsheet id="spreadsheet" src="/demo_sample.xls"
maxrows="200"
maxcolumns="40"
width="100%"
height="450px"></spreadsheet>
</div>
</zk>
Sheet name
We can get number of sheet from Book, and we can get sheet name by index.
Combobox sheets;
Spreadsheet spreadsheet;
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
List<String> sheetNames = new ArrayList<String>();
int sheetSize = spreadsheet.getBook().getNumberOfSheets();
for (int i = 0; i < sheetSize; i++){
sheetNames.add(spreadsheet.getSheet(i).getSheetName());
}
BindingListModelList model = new BindingListModelList(sheetNames, true);
sheets.setModel(model);
}
Select sheet
Select sheet by Spreadsheet.setSelectedSheet()
public void onSelect$sheets(Event event) {
spreadsheet.setSelectedSheet(sheets.getText());
}
Version History
Version | Date | Content |
---|---|---|
All source code listed in this book is at Github.