title: Cell Expansion is not happening while exporting jasper reports to XLS format
body: <p>I have an ireport with static fields and text fields.The database consists of large part of data and for single row in a database there is multiple line data.So when i am exporting the jasper report through java code to PDF format it is stretching and elaborating and printing the entire data without any missing of lines but when i am exporting to XLS it is missing the data and moreover stretching of the cell is not happening.I will show an image for better understanding.<a href="https://i.stack.imgur.com/8HgH6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8HgH6.png" alt="enter image description here"></a></p>
  
  <p>As you can see in the above the data is printing very clearly in PDF.
  <a href="https://i.stack.imgur.com/uDh8Q.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uDh8Q.png" alt="enter image description here"></a></p>
  
  <p>In the above,that is XLS format data is hiding or in the sense missing.So my question is how to display the entire data in a cell when reports are exported to XLS format.I am posting java code below.</p>
  
  <pre><code>    ServletContext context = request.getServletContext(); 
      String fullPath = context.getRealPath("/WEB-INF/reports/report5.jrxml");
      InputStream input = new FileInputStream(new File(fullPath));
      JasperDesign jasperDesign = JRXmlLoader.load(input);
  
      System.out.println("Compiling Report Designs");
      JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
  
      System.out.println("Creating JasperPrint Object");
      HashMap&lt;String,Object&gt; map = new HashMap&lt;String,Object&gt;();
      map.put("sql",sql);
      JasperPrint jasperPrint = JasperFillManager.fillReport (jasperReport,map,conn); 
      byte bytes[] = new byte[10000]; 
      //String result = JasperRunManager.runReportToHtmlFile("./usertemplates/test.jasper" , parameters, conn); 
  
  
  
      JRXlsxExporter exporter = new JRXlsxExporter();
      ByteArrayOutputStream xlsReport = new ByteArrayOutputStream(); 
  exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
  exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(xlsReport));
  SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
  configuration.setWhitePageBackground(true);
  configuration.setDetectCellType(true);
  configuration.setFontSizeFixEnabled(true);
  exporter.setConfiguration(configuration);
  exporter.exportReport();
      //System.out.println("Size of byte array:"+xlsReport.size()); 
      //bytes = xlsReport.toByteArray();
      String fileName = "InvoiceReport.xls";
  response.setHeader("Content-Disposition", "inline; filename="
  + fileName);
      response.setContentType("application/vnd.ms-excel"); 
      //System.out.println("After JasperPrint = 1"); 
      response.setContentLength(xlsReport.size()); 
      //System.out.println("After JasperPrint = 2"); 
      //xlsReport.close(); 
      //System.out.println("After JasperPrint = 3"); 
  
      OutputStream outputStream = response.getOutputStream(); 
      System.out.println("After JasperPrint = 4"); 
      xlsReport.writeTo(outputStream); 
      outputStream.flush(); 
      //outputStream.close(); 
      } 
      catch(Exception e) 
      {e.printStackTrace();} 
  
          %&gt;
  </code></pre>
  
  <p>and the jrxml code is below.</p>
  
  <p>report5.jrxml</p>
  
  <pre><code>&lt;detail&gt;
          &lt;band height="20" splitType="Prevent"&gt;
              &lt;textField isStretchWithOverflow="true"&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="13" height="20" isPrintWhenDetailOverflows="true" uuid="24b49d3f-5c78-4a19-a4d2-e2cbff95a40d"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$V{serial number}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true"&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="13" y="0" width="242" height="20" isPrintWhenDetailOverflows="true" uuid="4332ae75-6371-4879-b805-9d07254f0784"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{DescriptionOfGoods}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true"&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="309" y="0" width="86" height="20" isPrintWhenDetailOverflows="true" uuid="54828e8d-bae0-4669-873e-36de8bf54446"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{PerUnitPrice}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;staticText&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="395" y="0" width="64" height="20" isPrintWhenDetailOverflows="true" uuid="e02408a1-2bcd-4fb9-94d3-ed0c0c1d8ff6"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle" markup="none"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;text&gt;&lt;![CDATA[Nos]]&gt;&lt;/text&gt;
              &lt;/staticText&gt;
              &lt;textField isStretchWithOverflow="true"&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="459" y="0" width="96" height="20" isPrintWhenDetailOverflows="true" uuid="00ba44d4-b287-4a29-8bf3-1ad07da760e8"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{Quantity} *$F{PerUnitPrice}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
              &lt;textField isStretchWithOverflow="true"&gt;
                  &lt;reportElement positionType="Float" stretchType="RelativeToTallestObject" x="255" y="0" width="54" height="20" isPrintWhenDetailOverflows="true" uuid="d74b9bd4-9608-44a7-b46e-55f39ed0c852"&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/&gt;
                      &lt;property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/&gt;
                  &lt;/reportElement&gt;
                  &lt;box&gt;
                      &lt;topPen lineWidth="0.5"/&gt;
                      &lt;leftPen lineWidth="0.5"/&gt;
                      &lt;bottomPen lineWidth="0.5"/&gt;
                      &lt;rightPen lineWidth="0.5"/&gt;
                  &lt;/box&gt;
                  &lt;textElement textAlignment="Center" verticalAlignment="Middle"&gt;
                      &lt;font fontName="Times New Roman" pdfFontName="Times-Roman" isPdfEmbedded="true"/&gt;
                  &lt;/textElement&gt;
                  &lt;textFieldExpression&gt;&lt;![CDATA[$F{Quantity}]]&gt;&lt;/textFieldExpression&gt;
              &lt;/textField&gt;
          &lt;/band&gt;
      &lt;/detail&gt;
  </code></pre>