public class ExcelDataSource extends AbstractPoiXlsDataSource
The default naming convention is to name report fields COLUMN_x and map each column with the field found at index x in each row (these indices start with 0). To avoid this situation, users can either specify a collection of column names or set a flag to read the column names from the first row of the XLSX or XLS file.
columnNames, dateFormat, EXCEPTION_MESSAGE_KEY_XLS_COLUMN_NAMES_MISMATCH_COLUMN_INDEXES, EXCEPTION_MESSAGE_KEY_XLS_FIELD_VALUE_NOT_RETRIEVED, EXCEPTION_MESSAGE_KEY_XLS_SHEET_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_XLS_SHEET_NOT_FOUND, numberFormat, sheetSelection, useFirstRowAsHeader
EXCEPTION_MESSAGE_KEY_CANNOT_CONVERT_FIELD_TYPE, EXCEPTION_MESSAGE_KEY_CANNOT_MODIFY_PROPERTIES_AFTER_START, EXCEPTION_MESSAGE_KEY_NODE_NOT_AVAILABLE, EXCEPTION_MESSAGE_KEY_NULL_DOCUMENT, EXCEPTION_MESSAGE_KEY_NULL_SELECT_EXPRESSION, EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME, EXCEPTION_MESSAGE_KEY_UNKNOWN_NUMBER_TYPE
Constructor and Description |
---|
ExcelDataSource(java.io.File file,
ExcelFormatEnum format)
Creates a data source instance from an XLSX or XLS file.
|
ExcelDataSource(java.io.InputStream is,
ExcelFormatEnum format)
Creates a data source instance from an XLSX or XLS data input stream.
|
ExcelDataSource(JasperReportsContext jasperReportsContext,
java.lang.String location)
Creates a datasource instance that reads XLSX or XLS data from a given location.
|
ExcelDataSource(JasperReportsContext jasperReportsContext,
java.lang.String location,
ExcelFormatEnum format)
Creates a datasource instance that reads XLSX or XLS data from a given location.
|
ExcelDataSource(java.lang.String location,
ExcelFormatEnum format) |
ExcelDataSource(Workbook workbook)
Creates a data source instance from a workbook with the default autodetect Excel format.
|
Modifier and Type | Method and Description |
---|---|
protected Workbook |
loadWorkbook(java.io.InputStream inputStream) |
checkReadStarted, close, getFieldValue, moveFirst, next
getColumnNames, getDateFormat, getNumberFormat, getSheetSelection, setColumnIndexes, setColumnNames, setColumnNames, setDateFormat, setNumberFormat, setSheetSelection, setUseFirstRowAsHeader
convertNumber, convertStringValue, getConvertBean, getDatePattern, getFormattedDate, getFormattedNumber, getLocale, getNumberPattern, getTextAttributes, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTextAttributes, setTimeZone, setTimeZone
public ExcelDataSource(Workbook workbook)
workbook
- the workbookpublic ExcelDataSource(java.io.InputStream is, ExcelFormatEnum format) throws JRException, java.io.IOException
is
- an input stream containing XLSX or XLS dataformat
- the Excel formatJRException
java.io.IOException
public ExcelDataSource(java.io.File file, ExcelFormatEnum format) throws JRException, java.io.IOException
file
- a file containing XLSX or XLS dataformat
- the Excel formatjava.io.FileNotFoundException
JRException
java.io.IOException
public ExcelDataSource(JasperReportsContext jasperReportsContext, java.lang.String location) throws JRException, java.io.IOException
jasperReportsContext
- the JasperReportsContextlocation
- a String representing XLSX or XLS data sourcejava.io.IOException
JRException
public ExcelDataSource(JasperReportsContext jasperReportsContext, java.lang.String location, ExcelFormatEnum format) throws JRException, java.io.IOException
jasperReportsContext
- the JasperReportsContextlocation
- a String representing XLSX or XLS data sourceformat
- the Excel formatjava.io.IOException
JRException
public ExcelDataSource(java.lang.String location, ExcelFormatEnum format) throws JRException, java.io.IOException
JRException
java.io.IOException
ExcelDataSource(JasperReportsContext, String)
protected Workbook loadWorkbook(java.io.InputStream inputStream) throws java.io.IOException
loadWorkbook
in class AbstractPoiXlsDataSource
java.io.IOException
© 2001-2014 TIBCO Software Inc. www.jaspersoft.com