title: Crystal Reports with Java
body: <p>I am using Java to generate crystal reports locally -not on report application server- and trying to export to XLSX format.
  but so far, I was only able to export to xls format.</p>
  
  <p>does the java library for crystal reports support xlsx format?</p>
  
  <p><code>Edit 2018-02-02</code></p>
  
  <p>if possible, I want the file to be saved directly as XLSX.
  I found some suggestions on SAP forums saying that you can open it in xls and then save as xlsx.</p>
  
  <p>but the problem is that my report has too many rows and exceeds the sheet limit, so crystal report will create a new sheet every time the row count exceeds the limit.</p>
  
  <p>if I were to save in xls and then open and save as xlsx, then I will have to merge the sheets and I am not sure of the impact this will have on formatting.</p>
  
  <p><code>update 2018-02-15:</code></p>
  
  <p>I was able to export directly to xlsx using the JAR files provided on the crystal reports web site: <a href="http://www.crystalreports.com/crviewer-confirm/" rel="nofollow noreferrer">Crystal reports SAP</a> , after downloading the crystal report viewer, I added some jars in the folders under: ..\Crystal Reports Viewer\SAP Crystal Reports viewer\plugins and using those jars I was able to export with:</p>
  
  <pre><code>    DataOnlyExcelExportFormatOptions options = new 
      DataOnlyExcelExportFormatOptions();
      options.setMaintainColumnAlignment(true);
      options.setSimplifyPageHeaders(false);
      options.setExportPageHeaderAndFooter(true);
      options.setUseWorksheetFunctionsForSummaries(true);
      options.setBaseAreaType(AreaSectionKind.detail);
      ExportOptions exportOpt = new ExportOptions();
      exportOpt.setFormatOptions(options);
      exportOpt.setExportFormatType(ReportExportFormat.recordToMSExcel2007);
      ...
      ReportClientDocument doc1 = ReportClientDocument.openReport(f);
      ...
      PrintOutputController printer = doc1.getPrintOutputController();
      printer.export(exportOpt, fileOutputStream);
  </code></pre>
  
  <p>line of concern here is: ReportExportFormat.recordToMSExcel2007</p>
  
  <p>this will export directly to xlsx.</p>