Package de.businesscode.bcdui.wrs.export
Class Wrs2Excel
- java.lang.Object
-
- de.businesscode.bcdui.wrs.export.Wrs2Excel
-
public class Wrs2Excel extends java.lang.Object
Wrs to Excel (.xlsx) data exporter: exports data from Wrs into sheet(s) of target excel template, uses efficient streaming API when interfacing with input document and output. Due to streaming API the input Wrs document must strictly adhere to Wrs schema. BUI-537
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Wrs2Excel.TemplateResolver
resolves template file via templateName abstraction, usually implemented by container component, i.e. servlet and returns the input-stream to the template
-
Constructor Summary
Constructors Constructor Description Wrs2Excel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeWorkbook()
closes workbookvoid
export(java.io.Reader wrsReader, java.io.OutputStream excelOutputStream, IRequestOptions options, javax.servlet.http.HttpServletRequest req)
exports data from wrsInputStream into new Excel file created from the excel target template and writes into excelOutputStream via streaming APIprotected void
openWorkbook(java.lang.String excelTemplateName)
opens excel template by name, to be resolved by template-resolver, the template resolver must be previously set viasetTemplateResolver(TemplateResolver)
Wrs2Excel
setTemplateResolver(Wrs2Excel.TemplateResolver templateResolver)
sets template resolver to resolve templates by nameprotected void
writeWorkbook(java.io.OutputStream excelOutputStream)
saves the workbook to given outputStream
-
-
-
Method Detail
-
export
public void export(java.io.Reader wrsReader, java.io.OutputStream excelOutputStream, IRequestOptions options, javax.servlet.http.HttpServletRequest req) throws java.lang.Exception
exports data from wrsInputStream into new Excel file created from the excel target template and writes into excelOutputStream via streaming API- Parameters:
wrsReader
- - to read from; contains wrs:WrsContainer with Wrs document(s) containing renderer:Wrs2Excel information headerexcelOutputStream
- - to write into (binary content, .xlsx)- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
- - in case anything goes rongjava.lang.Exception
-
setTemplateResolver
public Wrs2Excel setTemplateResolver(Wrs2Excel.TemplateResolver templateResolver)
sets template resolver to resolve templates by name- Parameters:
templateResolver
-
-
closeWorkbook
protected void closeWorkbook() throws de.businesscode.bcdui.wrs.export.ExcelWriterException
closes workbook- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
openWorkbook
protected final void openWorkbook(java.lang.String excelTemplateName) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
opens excel template by name, to be resolved by template-resolver, the template resolver must be previously set viasetTemplateResolver(TemplateResolver)
- Parameters:
excelTemplateName
- name of an Excel template on a well-known location or null to start with an empty sheet- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
writeWorkbook
protected void writeWorkbook(java.io.OutputStream excelOutputStream) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
saves the workbook to given outputStream- Parameters:
excelOutputStream
-- Throws:
de.businesscode.bcdui.wrs.export.ExcelWriterException
-
-