Package de.businesscode.bcdui.wrs.export
Class ExcelSylkTemplate
java.lang.Object
de.businesscode.bcdui.wrs.export.ExcelSylkTemplate
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class encapsulates a pair of a column caption and the respective data column name. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionExcelSylkTemplate
(ResultSetMetaData metaData, int rowCountIfKnown) Creates an Excel exported instance and exports all rows that occur in the metaData.ExcelSylkTemplate
(ResultSetMetaData metaData, int rowCountIfKnown, I18nDbResources i18nDbResources) ExcelSylkTemplate
(ResultSetMetaData metaData, int rowCountIfKnown, List<ExcelSylkTemplate.ColumnMapping> orderedLogicalColumnNames) Creates an Excel exported instance.ExcelSylkTemplate
(ResultSetMetaData metaData, int rowCountIfKnown, List<ExcelSylkTemplate.ColumnMapping> orderedLogicalColumnNames, I18nDbResources i18nDbResources) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
escapeColNamesForSylk
(List<de.businesscode.bcdui.wrs.export.ExcelSylkTemplate.ColumnMappingEx> orderedLogicalColumnNames) protected String
protected String
getContentRecord
(String content, int colNr, String extraData) static String
getDaysSince1900
(String dateString) get hash with wishContents of column with linksprotected String
protected void
readColFormats
(ResultSetMetaData metaData, List<de.businesscode.bcdui.wrs.export.ExcelSylkTemplate.ColumnMappingEx> orderedLogicalColumnNames) void
setAddInfo
(String addInfo) void
setApplicationURL
(String applicationURL) void
setHttpHeader
(String httpHeader) void
setHttpHeadersMap
(HashMap<String, String> headersMap) set the hash with url string captions for the exel exportprotected void
writeAddInfo
(PrintWriter output) protected void
writeColNamesRow
(PrintWriter output) protected void
writeEndRecord
(PrintWriter output) static void
writeErrorMessage
(PrintWriter output, String message) write the error message into the actual excel file contenttype from servlet must be "application/vnd.ms-excel"protected void
writeHeader
(PrintWriter output) protected int
writeRowsWoFormat
(PrintWriter output, ResultSet resultSet, int startRow, int nrRowsToFlush) int
writeStandardTable
(PrintWriter output, ResultSet resultSet, int nrRowsToFlush) write a the table with the 'standard' (see getStandardHeader() ) configuration
-
Field Details
-
header
-
idRecord
-
defaultFormat
-
generalOptions
-
columnNameFormat
-
addInfoFormat
-
colFormats
-
isTranslated
protected boolean[] isTranslated -
getsQuotes
protected boolean[] getsQuotes -
httpHeader
-
-
Constructor Details
-
ExcelSylkTemplate
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 onresultSet
- the result set to writenrRowsToFlush
- no. of resultset/excel rows after which stream is flushed- Throws:
IOException
SQLException
-
writeHeader
- Throws:
IOException
-
writeEndRecord
- Throws:
IOException
-
writeColNamesRow
- Throws:
IOException
-
writeAddInfo
- Throws:
IOException
-
getHttpHeader
-
setHttpHeader
-
getContentRecord
-
getDaysSince1900
- 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
-
getColFormatDeclarations
-
writeRowsWoFormat
protected int writeRowsWoFormat(PrintWriter output, ResultSet resultSet, int startRow, int nrRowsToFlush) throws IOException, SQLException - Throws:
IOException
SQLException
-
writeErrorMessage
write the error message into the actual excel file contenttype from servlet must be "application/vnd.ms-excel"- Parameters:
output
- - where writemessage
- - string to write- Throws:
IOException
-
getHttpHeadersMap
get hash with wishContents of column with links- Returns:
- Returns the httpHeadersMap.
-
setHttpHeadersMap
set the hash with url string captions for the exel export- Parameters:
headersMap
- The httpHeadersMap to set.
-
getApplicationURL
-
getAddInfo
-
setApplicationURL
- Parameters:
applicationURL
- - like "http://localhost:8080/opms"
-
setAddInfo
-