Package net.sf.jasperreports.engine.data

Examples of net.sf.jasperreports.engine.data.JRXlsDataSource


  public JRDataSource createDatasource() throws JRException {
    try {
      Workbook workbook = (Workbook) getParameterValue(JRXlsQueryExecuterFactory.XLS_WORKBOOK);
      if (workbook != null) {
        datasource = new JRXlsDataSource(workbook);
      } else {
        InputStream xlsInputStream = (InputStream) getParameterValue(JRXlsQueryExecuterFactory.XLS_INPUT_STREAM);
        if (xlsInputStream != null) {
          datasource = new JRXlsDataSource(xlsInputStream);
        } else {
          File xlsFile = (File) getParameterValue(JRXlsQueryExecuterFactory.XLS_FILE);
          if (xlsFile != null) {
            datasource = new JRXlsDataSource(xlsFile);
          } else {
            String xlsSource = getStringParameterOrProperty(JRXlsQueryExecuterFactory.XLS_SOURCE);
            if (xlsSource != null) {
              datasource = new JRXlsDataSource(xlsSource);
            } else {
              if (log.isWarnEnabled()){
                log.warn("No XLS source was provided.");
              }
            }
View Full Code Here


  /**
   *
   */
  private static JRXlsDataSource getDataSource() throws JRException
  {
    JRXlsDataSource ds;
   
    try
    {
      String[] columnNames = new String[]{"city", "id", "name", "address", "state"};
      int[] columnIndexes = new int[]{0, 2, 3, 4, 5};
      ds = new JRXlsDataSource(JRLoader.getLocationInputStream("data/XlsDataSource.data.xls"));
//      ds.setUseFirstRowAsHeader(true);
      ds.setColumnNames(columnNames, columnIndexes);
    }
    catch (IOException e)
    {
      throw new JRException(e);
    }
View Full Code Here

TOP

Related Classes of net.sf.jasperreports.engine.data.JRXlsDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.