Difference between revisions of "WikiTaskTutorial/Excel"
Jump to navigation
Jump to search
Line 25: | Line 25: | ||
</source> | </source> | ||
<pre> | <pre> | ||
− | {{wikitask|cmd=runtemplate|input=http:// | + | {{wikitask|cmd=runtemplate|input=http://wiki.bitplan.com/images/wiki/a/a4/Air-routes.xlsx|engine=Rythm|template={{FULLPAGENAMEE}}#template|targetpage={{FULLPAGENAMEE}}#result}} |
</pre> | </pre> | ||
− | {{wikitask|cmd=runtemplate|input=http:// | + | {{wikitask|cmd=runtemplate|input=http://wiki.bitplan.com/images/wiki/a/a4/Air-routes.xlsx|engine=Rythm|template={{FULLPAGENAMEE}}#template|targetpage={{FULLPAGENAMEE}}#result}} |
== result == | == result == | ||
Excel file: http://cdcontent.books24x7.com/id_16959/real%20estate%20table.xlsx | 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 | can not be opened due to error No valid entries or contents found, this is not a valid OOXML (Office Open XML) file |
Revision as of 08:47, 27 April 2020
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