WikiTaskTutorial/Excel
Jump to navigation
Jump to search
This is an Example for accessing an Excel xlsx document from a WikiTask. The example file is File:Air-routes.xlsx generated with the SimpleGraph-Excel module.
template
This template includes Office#Excel
@include(wiki.Office.Excel)
Excel file: @(wikiTask.getInput())
@if(excel.error) {
can not be opened due to error @(excel.error.getMessage())
} else { has the following sheets:
@for (int i=0;i<excel.workbook.getNumberOfSheets();i++) { @{XSSFSheet sheet = excel.workbook.getSheetAt(i);List<List<String>> sheetContent=excel.getSheetContent(sheet);String delim="!"}
=== @(sheet.getSheetName()) ===
@("{")|class="wikitable sortable"
@for (List<String> row:sheetContent) { @for (col:row) {
@(delim)@col
}
|-
@{ delim="|" }
}
@("|}")
}
}
@{ try { excel.workbook.close(); } catch (Throwable th) { }}
{{wikitask|cmd=runtemplate|input=http://wiki.bitplan.com/images/wiki/a/a4/Air-routes.xlsx|engine=Rythm|template={{FULLPAGENAMEE}}#template|targetpage={{FULLPAGENAMEE}}#result}}
runtemplate -> WikiTaskTutorial/Excel#result
result
Excel file: http://cdcontent.books24x7.com/id_16959/real%20estate%20table.xlsx can not be opened due to error No valid entries or contents found, this is not a valid OOXML (Office Open XML) file