net.sf.jasperreports.engine.data

## Class JRXlsxDataSource

- java.lang.Object
- - net.sf.jasperreports.engine.data.JRAbstractTextDataSource
  - - net.sf.jasperreports.engine.data.AbstractXlsDataSource
    - - net.sf.jasperreports.engine.data.AbstractPoiXlsDataSource
      - - net.sf.jasperreports.engine.data.JRXlsxDataSource

- All Implemented Interfaces:
    JRDataSource, JRRewindableDataSource

      public class JRXlsxDataSource
      extends AbstractPoiXlsDataSource

  This data source implementation reads an XLSX stream.

  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 file.

  Version:
    $Id: JRXlsxDataSource.java 6986 2014-03-26 09:50:48Z teodord $
  Author:
    sanda zaharia (shertage@users.sourceforge.net)

- - ### Field Summary

    - ### Fields inherited from class net.sf.jasperreports.engine.data.AbstractXlsDataSource

      `columnNames, dateFormat, numberFormat, sheetSelection, useFirstRowAsHeader`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRXlsxDataSource(java.io.File file)` Creates a data source instance from an XLSX file.
    `JRXlsxDataSource(java.io.InputStream inputStream)` Creates a data source instance from an XLSX data input stream.
    `JRXlsxDataSource(JasperReportsContext jasperReportsContext, java.lang.String location)` Creates a data source instance that reads XLSX data from a given location.
    `JRXlsxDataSource(java.lang.String location)`
    `JRXlsxDataSource(org.apache.poi.ss.usermodel.Workbook workbook)` Creates a data source instance from a workbook.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected org.apache.poi.ss.usermodel.Workbook` | `loadWorkbook(java.io.InputStream inputStream)`

    - ### Methods inherited from class net.sf.jasperreports.engine.data.AbstractPoiXlsDataSource

      `checkReadStarted, close, getFieldValue, moveFirst, next`

    - ### Methods inherited from class net.sf.jasperreports.engine.data.AbstractXlsDataSource

      `getColumnNames, getDateFormat, getNumberFormat, getSheetSelection, setColumnIndexes, setColumnNames, setColumnNames, setDateFormat, setNumberFormat, setSheetSelection, setUseFirstRowAsHeader`

    - ### Methods inherited from class net.sf.jasperreports.engine.data.JRAbstractTextDataSource

      `convertNumber, convertStringValue, getConvertBean, getDatePattern, getFormattedDate, getFormattedNumber, getLocale, getNumberPattern, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTimeZone, setTimeZone`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JRXlsxDataSource

          public JRXlsxDataSource(org.apache.poi.ss.usermodel.Workbook workbook)

      Creates a data source instance from a workbook.
      Parameters:
        `workbook` - the workbook

    - #### JRXlsxDataSource

          public JRXlsxDataSource(java.io.InputStream inputStream)
                           throws JRException,
                                  java.io.IOException

      Creates a data source instance from an XLSX data input stream.
      Parameters:
        `inputStream` - an input stream containing XLSX data
      Throws:
        `JRException`
        `java.io.IOException`

    - #### JRXlsxDataSource

          public JRXlsxDataSource(java.io.File file)
                           throws JRException,
                                  java.io.FileNotFoundException,
                                  java.io.IOException

      Creates a data source instance from an XLSX file.
      Parameters:
        `file` - a file containing XLSX data
      Throws:
        `JRException`
        `java.io.FileNotFoundException`
        `java.io.IOException`

    - #### JRXlsxDataSource

          public JRXlsxDataSource(JasperReportsContext jasperReportsContext,
                          java.lang.String location)
                           throws JRException,
                                  java.io.IOException

      Creates a data source instance that reads XLSX data from a given location.
      Parameters:
        `jasperReportsContext` - the JasperReportsContext
        `location` - a String representing XLSX data source
      Throws:
        `java.io.IOException`
        `JRException`

    - #### JRXlsxDataSource

          public JRXlsxDataSource(java.lang.String location)
                           throws JRException,
                                  java.io.IOException

      Throws:
        `JRException`
        `java.io.IOException`
      See Also:
        `JRXlsxDataSource(JasperReportsContext, String)`

  - ### Method Detail

    - #### loadWorkbook

          protected org.apache.poi.ss.usermodel.Workbook loadWorkbook(java.io.InputStream inputStream)
                                                               throws java.io.IOException

      Specified by:
        `loadWorkbook` in class `AbstractPoiXlsDataSource`
      Throws:
        `java.io.IOException`

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com