Skip to content

Instantly share code, notes, and snippets.

@uttamhn
Created May 28, 2013 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uttamhn/8a823eb4fd077b06ee62 to your computer and use it in GitHub Desktop.
Save uttamhn/8a823eb4fd077b06ee62 to your computer and use it in GitHub Desktop.
ZK Page load sample
Book book = ss.getSelectedSheet().getBook() //get the book object
Worksheet fidelityStatement = book.createSheet(“Fidelity”) //Create Fidelity statement
Worksheet pncStatement = book.createSheet(“PNC”)
//Set your headers or footers for your sheet
//Now load the data if you have any to the sheets you just created
for(int rowCount = startRow; rowCount < endRow; rowCount= rowCount+2){
for(int startCell = startColumn; startCell < endColumn; startCell++){
org.zkoss.poi.hssf.usermodel.HSSFCell c1 = Utils.getOrCreateCell(sheet,rowCount,startCell)
org.zkoss.poi.hssf.usermodel.HSSFCell c2 = Utils.getOrCreateCell(sheet,rowCount+1,startCell)
if(sheetNo == 0){
//if this method is called for calculaton feilds on content sheet.
if(startRow1 != 3){
c1.setCellStyle(styleList[3])
c2.setCellStyle(styleList[0])
if(quantityColumns && quantityColumns.contains(startCell-3)){//24
c1.setCellStyle(styleList[6])
c2.setCellStyle(styleList[6])
}
..................
//You can get the data as I did from your domain module, using famous groovy findBy or findAll
InstStatement iStatement = InstStatement.findByEffectiveDate(it, fromDate)
if(iStatement){
Utils.setCellValue(sheet, rowNumber , columnNumber, it.tranDate)
Utils.setCellValue(sheet, rowNumber , columnNumber++ ,it.tranType)
Utils.setCellValue(sheet, rowNumber , columnNumber++,it.amount)
Utils.setCellValue(sheet, rowNumber , columnNumber++,balance)
}
.
.
.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment