Class ExcelSylkTemplate

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

public class ExcelSylkTemplate extends Object
  • Field Details

    • idRecord

      protected String idRecord
    • defaultFormat

      protected String defaultFormat
    • generalOptions

      protected String generalOptions
    • columnNameFormat

      protected String columnNameFormat
    • addInfoFormat

      protected String addInfoFormat
    • colFormats

      protected String[] colFormats
    • isTranslated

      protected boolean[] isTranslated
    • getsQuotes

      protected boolean[] getsQuotes
    • httpHeader

      protected String httpHeader
  • Constructor Details

    • ExcelSylkTemplate

      public ExcelSylkTemplate(ResultSetMetaData metaData, int rowCountIfKnown) throws SQLException
      Creates an Excel exported instance and exports all rows that occur in the metaData.
      Important: Do not set rowCountIfKnown to a wrong value, because otherwise you will get an error message "Error in row 17".
      Parameters:
      metaData - The meta data the column names will be taken from.
      rowCountIfKnown - Set this to 0 if you do not know the exact number of rows the result set will contain. Otherwise set the row count here.
      Throws:
      SQLException
    • ExcelSylkTemplate

      public ExcelSylkTemplate(ResultSetMetaData metaData, int rowCountIfKnown, List<ExcelSylkTemplate.ColumnMapping> orderedLogicalColumnNames) throws SQLException
      Creates an Excel exported instance.
      Important: Do not set rowCountIfKnown to a wrong value, because otherwise you will get an error message "Error in row 17".
      Parameters:
      metaData - The meta data the column names will be taken from.
      rowCountIfKnown - Set this to 0 if you do not know the exact number of rows the result set will contain. Otherwise set the row count here.
      orderedLogicalColumnNames - The list of column captions and database column names to be exported in exactly the list order. This can be null if the exported columns should be taken from the result set meta data.
      Throws:
      SQLException
    • ExcelSylkTemplate

      public ExcelSylkTemplate(ResultSetMetaData metaData, int rowCountIfKnown, I18nDbResources i18nDbResources) throws SQLException
      Throws:
      SQLException
    • ExcelSylkTemplate

      public ExcelSylkTemplate(ResultSetMetaData metaData, int rowCountIfKnown, List<ExcelSylkTemplate.ColumnMapping> orderedLogicalColumnNames, I18nDbResources i18nDbResources) throws SQLException
      Throws:
      SQLException
  • Method Details

    • writeStandardTable

      public int writeStandardTable(PrintWriter output, ResultSet resultSet, int nrRowsToFlush) throws IOException, SQLException
      write a the table with the 'standard' (see getStandardHeader() ) configuration
      Parameters:
      output - stream to write on
      resultSet - the result set to write
      nrRowsToFlush - no. of resultset/excel rows after which stream is flushed
      Throws:
      IOException
      SQLException
    • writeHeader

      protected void writeHeader(PrintWriter output) throws IOException
      Throws:
      IOException
    • writeEndRecord

      protected void writeEndRecord(PrintWriter output) throws IOException
      Throws:
      IOException
    • writeColNamesRow

      protected void writeColNamesRow(PrintWriter output) throws IOException
      Throws:
      IOException
    • writeAddInfo

      protected void writeAddInfo(PrintWriter output) throws IOException
      Throws:
      IOException
    • getHttpHeader

      public String getHttpHeader()
    • setHttpHeader

      public void setHttpHeader(String httpHeader)
    • getContentRecord

      protected String getContentRecord(String content, int colNr, String extraData)
    • getDaysSince1900

      public static String getDaysSince1900(String dateString) throws ParseException
      Throws:
      ParseException
    • readColFormats

      protected void readColFormats(ResultSetMetaData metaData, List<de.businesscode.bcdui.wrs.export.ExcelSylkTemplate.ColumnMappingEx> orderedLogicalColumnNames) throws SQLException
      Throws:
      SQLException
    • escapeColNamesForSylk

      protected void escapeColNamesForSylk(List<de.businesscode.bcdui.wrs.export.ExcelSylkTemplate.ColumnMappingEx> orderedLogicalColumnNames)
    • getStandardHeader

      protected String getStandardHeader()
    • getColFormatDeclarations

      protected String getColFormatDeclarations()
    • writeRowsWoFormat

      protected int writeRowsWoFormat(PrintWriter output, ResultSet resultSet, int startRow, int nrRowsToFlush) throws IOException, SQLException
      Throws:
      IOException
      SQLException
    • writeErrorMessage

      public static void writeErrorMessage(PrintWriter output, String message) throws IOException
      write the error message into the actual excel file contenttype from servlet must be "application/vnd.ms-excel"
      Parameters:
      output - - where write
      message - - string to write
      Throws:
      IOException
    • getHttpHeadersMap

      public HashMap<String,String> getHttpHeadersMap()
      get hash with wishContents of column with links
      Returns:
      Returns the httpHeadersMap.
    • setHttpHeadersMap

      public void setHttpHeadersMap(HashMap<String,String> headersMap)
      set the hash with url string captions for the exel export
      Parameters:
      headersMap - The httpHeadersMap to set.
    • getApplicationURL

      public String getApplicationURL()
    • getAddInfo

      public String getAddInfo()
    • setApplicationURL

      public void setApplicationURL(String applicationURL)
      Parameters:
      applicationURL - - like "http://localhost:8080/opms"
    • setAddInfo

      public void setAddInfo(String addInfo)