title: Jasper report missing first row
body: <p>I'm generating a report using <em>JasperReports</em> and suppose to export it into several formats. But currently im only working with excel reports. </p>
  
  <p>Here is my controller code.</p>
  
  <pre><code>    InputStream in = reportTemplate.getTemplate(reportInquery.getTemplateFile());
      JasperPrint print = JasperFillManager.fillReport(in, null,
                  new JRResultSetDataSource(reportDao.getReportData(reportInquery)));
      resp = HttpConfig.setHeaders(reportInquery, resp);
      Exporter exporter = reportOption.getRenderOptions(reportInquery.getFormat(), resp.getOutputStream(), print);
      exporter.exportReport();
  </code></pre>
  
  <p>In my configuration factory, excel report configures as follows, after calling <code>getRenderOptions</code> method.</p>
  
  <pre><code>    public Exporter exporterOptions(OutputStream outputStream, JasperPrint print) {
      JRXlsExporter exporter = new JRXlsExporter();
      exporter.setExporterInput(new SimpleExporterInput(print));
      OutputStreamExporterOutput outputStreamExporterOutput = new SimpleOutputStreamExporterOutput(outputStream);
      exporter.setExporterOutput(outputStreamExporterOutput);
      SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
      configuration.setOnePagePerSheet(true);
      configuration.setDetectCellType(true);
      configuration.setMaxRowsPerSheet(100);
      configuration.setRemoveEmptySpaceBetweenColumns(true);
      configuration.setRemoveEmptySpaceBetweenRows(true);
      exporter.setConfiguration(configuration);
      return exporter;
  }
  </code></pre>
  
  <p>To create <code>JRResultSetDataSource</code> I have used oracle <code>OracleCachedRowSet</code> in above <code>getReportData</code> method.</p>
  
  <pre><code>public RowSet getReportData(ReportInqueryDTO reportInquery) {
      try {
          String query = getQueryById(reportInquery.getTemplateId());
          Map&lt;String, String&gt; params = new HashMap&lt;&gt;();
          params.put("fromDate", reportInquery.getFromDate());
          params.put("toDate", reportInquery.getToDate());
          params.put("appName", this.applicationName);
  
          RowSet rowSet = namedParameterJdbcTemplate.query(query, params, new ResultSetExtractor&lt;RowSet&gt;() {
              @Override
              public RowSet extractData(ResultSet resultSet) throws SQLException, DataAccessException {
                  OracleCachedRowSet rs = new OracleCachedRowSet();
                  rs.populate(resultSet);
                  return rs;
              }
          });
  
  
          rowSet.beforeFirst();
          return rowSet;
      } catch (Exception exception) {
          log.error("getReportData failed.");
      }
      return null;
  }
  </code></pre>
  
  <p>My problem is, excel always comes with first record missing from, where the cursor of the <code>resultSet</code> is pointed. (Ex: Here <code>rowSet.beforeFirst()</code> means before 1st index. I'm missing the first record in this scenario.) </p>
  
  <p>I'm stuck with this issue couple of days. I want to know if this is a jasper issue how can I resolve it. If it can not be resolved, I want to know how to add a cached rowset dynamically before the first record?</p>
  
  <p>I have couple of jrxml files and, one of it is added below.Every file follows the same format.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!-- Created with Jaspersoft Studio version 6.0.0.final using JasperReports Library     version 6.0.0  --&gt;
  &lt;!-- 2014-12-30T15:20:10 --&gt;
  &lt;jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="TTT_Call_Transfers_Report" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b61676f8-0366-4125-996c-7564d0f77eb4"&gt;
  &lt;property name="com.jaspersoft.studio.data.defaultdataadapter" value="NewDataAdapter"/&gt;
  &lt;style name="Table_TH" mode="Opaque" backcolor="#F0F8FF"&gt;
      &lt;box&gt;
          &lt;pen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
      &lt;/box&gt;
  &lt;/style&gt;
  &lt;style name="Table_CH" mode="Opaque" backcolor="#BFE1FF"&gt;
      &lt;box&gt;
          &lt;pen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
      &lt;/box&gt;
  &lt;/style&gt;
  &lt;style name="Table_TD" mode="Opaque" backcolor="#FFFFFF"&gt;
      &lt;box&gt;
          &lt;pen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;topPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;leftPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;bottomPen lineWidth="0.5" lineColor="#000000"/&gt;
          &lt;rightPen lineWidth="0.5" lineColor="#000000"/&gt;
      &lt;/box&gt;
  &lt;/style&gt;
  &lt;subDataset name="Dataset1" uuid="54db10cf-a696-4f7d-b642-96871feb617d"&gt;
      &lt;property name="com.jaspersoft.studio.data.defaultdataadapter" value="NewDataAdapter"/&gt;
      &lt;queryString language="SQL"&gt;
          &lt;![CDATA[]]&gt;
      &lt;/queryString&gt;
      &lt;field name="DATE_OF_TRANSFER" class="java.sql.Timestamp"/&gt;
      &lt;field name="AGENT_ID" class="java.lang.String"/&gt;
      &lt;field name="AGENT_NAME" class="java.lang.String"/&gt;
      &lt;field name="CTALK_CONTACT_ID" class="java.lang.String"/&gt;
      &lt;field name="ASSOCIATED_QUEUE_ID" class="java.lang.String"/&gt;
  &lt;/subDataset&gt;
  &lt;queryString language="SQL"&gt;
      &lt;![CDATA[]]&gt;
  &lt;/queryString&gt;
  &lt;background&gt;
      &lt;band splitType="Stretch"/&gt;
  &lt;/background&gt;
  &lt;title&gt;
      &lt;band height="63" splitType="Stretch"&gt;
          &lt;staticText&gt;
              &lt;reportElement x="160" y="16" width="222" height="30" uuid="d89e2553-d3fb-4360-b797-4f69b60938a5"/&gt;
              &lt;text&gt;&lt;![CDATA[TTT Call Transfers Report]]&gt;&lt;/text&gt;
          &lt;/staticText&gt;
      &lt;/band&gt;
  &lt;/title&gt;
  &lt;detail&gt;
      &lt;band height="253" splitType="Stretch"&gt;
          &lt;componentElement&gt;
              &lt;reportElement x="0" y="0" width="555" height="253" uuid="c229d6c3-18b7-4de2-a669-01e11d25c642"/&gt;
              &lt;jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"&gt;
                  &lt;datasetRun subDataset="Dataset1" uuid="e0262612-dc81-4d84-abf8-9b52609ba792"&gt;
                      &lt;datasetParameter name="REPORT_DATA_SOURCE"&gt;
                          &lt;datasetParameterExpression&gt;&lt;![CDATA[$P{REPORT_DATA_SOURCE}]]&gt;&lt;/datasetParameterExpression&gt;
                      &lt;/datasetParameter&gt;
                  &lt;/datasetRun&gt;
                  &lt;jr:column width="40" uuid="a91061c3-7760-43d2-bdc1-091f0e712aaa"&gt;
                      &lt;jr:columnHeader style="Table_CH" height="30"&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="6afcdf24-958c-49f4-9ef3-b757ffd1e8de"/&gt;
                              &lt;text&gt;&lt;![CDATA[DATE_OF_TRANSFER]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/jr:columnHeader&gt;
                      &lt;jr:columnFooter style="Table_CH" height="30"/&gt;
                      &lt;jr:detailCell style="Table_TD" height="30"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="84a5e4b7-30e0-409c-b2ab-e13c1dd02950"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$F{DATE_OF_TRANSFER}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/jr:detailCell&gt;
                  &lt;/jr:column&gt;
                  &lt;jr:column width="40" uuid="c7b5a8eb-04b6-4cd6-9328-e1e8ce11a2fc"&gt;
                      &lt;jr:columnHeader style="Table_CH" height="30"&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="d7cc290a-6918-4d47-8f55-b43761bee59b"/&gt;
                              &lt;text&gt;&lt;![CDATA[AGENT_ID]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/jr:columnHeader&gt;
                      &lt;jr:columnFooter style="Table_CH" height="30"/&gt;
                      &lt;jr:detailCell style="Table_TD" height="30"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="b5f2b8bf-9132-4447-9209-f1fcb3b873c4"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$F{AGENT_ID}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/jr:detailCell&gt;
                  &lt;/jr:column&gt;
                  &lt;jr:column width="40" uuid="d2427379-2c72-4e33-9b46-ade8727dbed5"&gt;
                      &lt;jr:columnHeader style="Table_CH" height="30"&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="bdcb01c5-5073-4a10-b498-e2d1a2cf7c78"/&gt;
                              &lt;text&gt;&lt;![CDATA[AGENT_NAME]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/jr:columnHeader&gt;
                      &lt;jr:columnFooter style="Table_CH" height="30"/&gt;
                      &lt;jr:detailCell style="Table_TD" height="30"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="e259ef09-f446-491c-88dd-f7694197e060"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$F{AGENT_NAME}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/jr:detailCell&gt;
                  &lt;/jr:column&gt;
                  &lt;jr:column width="40" uuid="81fe9b33-57aa-48b2-914b-e3e9b45cf6a1"&gt;
                      &lt;jr:columnHeader style="Table_CH" height="30"&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="ef5e379b-65de-4ea0-a5cb-13368efa16f0"/&gt;
                              &lt;text&gt;&lt;![CDATA[CTALK_CONTACT_ID]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/jr:columnHeader&gt;
                      &lt;jr:columnFooter style="Table_CH" height="30"/&gt;
                      &lt;jr:detailCell style="Table_TD" height="30"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="5f49f1a9-379a-4d02-9e55-fc6a865aa828"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$F{CTALK_CONTACT_ID}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/jr:detailCell&gt;
                  &lt;/jr:column&gt;
                  &lt;jr:column width="40" uuid="f6e8b2a6-925b-41b5-9043-1ffa215871f1"&gt;
                      &lt;jr:columnHeader style="Table_CH" height="30"&gt;
                          &lt;staticText&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="b55c7599-a237-43f1-aff5-464717e3c917"/&gt;
                              &lt;text&gt;&lt;![CDATA[ASSOCIATED_QUEUE_ID]]&gt;&lt;/text&gt;
                          &lt;/staticText&gt;
                      &lt;/jr:columnHeader&gt;
                      &lt;jr:columnFooter style="Table_CH" height="30"/&gt;
                      &lt;jr:detailCell style="Table_TD" height="30"&gt;
                          &lt;textField&gt;
                              &lt;reportElement x="0" y="0" width="40" height="30" uuid="0d2d53d0-1cb2-4d64-a09d-b0eeacca694d"/&gt;
                              &lt;textFieldExpression&gt;&lt;![CDATA[$F{ASSOCIATED_QUEUE_ID}]]&gt;&lt;/textFieldExpression&gt;
                          &lt;/textField&gt;
                      &lt;/jr:detailCell&gt;
                  &lt;/jr:column&gt;
              &lt;/jr:table&gt;
          &lt;/componentElement&gt;
      &lt;/band&gt;
  &lt;/detail&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks in advance.</p>