Class Wrs2Excel

java.lang.Object
de.businesscode.bcdui.wrs.export.Wrs2Excel

public class Wrs2Excel extends 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
  • Constructor Details

    • Wrs2Excel

      public Wrs2Excel()
  • Method Details

    • export

      public void export(Reader wrsReader, OutputStream excelOutputStream, IRequestOptions options, jakarta.servlet.http.HttpServletRequest req) throws 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 header
      excelOutputStream - - to write into (binary content, .xlsx)
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException - - in case anything goes rong
      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(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 via setTemplateResolver(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(OutputStream excelOutputStream) throws de.businesscode.bcdui.wrs.export.ExcelWriterException
      saves the workbook to given outputStream
      Parameters:
      excelOutputStream -
      Throws:
      de.businesscode.bcdui.wrs.export.ExcelWriterException