cancel
Showing results for 
Search instead for 
Did you mean: 

crystal reports with java

d-ruoss21
Explorer
0 Kudos

I want to use crystal report from a java application, with pre configured reports just pass them the parameter to the report, we allredy doing it like this but currently the report are created by a seprate c# service this one should be merged to the main java application

chat gpt says it should look like this

import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions;
import com.crystaldecisions.sdk.occa.report.exportoptions.PDFExportFormatOptions;

public class CrystalReportsExporter {
    public static void main(String[] args) {
        try {
            ReportClientDocument reportClientDoc = new ReportClientDocument();
            reportClientDoc.open("YourReportFile.rpt", 0);

            // Export the report to PDF
            ExportOptions exportOptions = new ExportOptions();
            PDFExportFormatOptions pdfExportFormatOptions = new PDFExportFormatOptions();
            exportOptions.setExportFormatType(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormatEnum.PDF);
            exportOptions.setFormatOptions(pdfExportFormatOptions);
            reportClientDoc.getReportSource().getExportOptions().setExportOptions(exportOptions);
            reportClientDoc.getReportSource().export("YourReportOutput.pdf");

            // Display the exported PDF report using an appropriate PDF viewer library
            // Code for displaying PDF in Java application goes here
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

 what is pretty simular like we to it now in c# 
where i will get the sdk for this

 

  • SAP Managed Tags:

Accepted Solutions (0)

Answers (0)