Knowage-Server icon indicating copy to clipboard operation
Knowage-Server copied to clipboard

[Knowage 8.1.26 CE] Problem exporting BIRT 4.17 report to Excel (page breaks not working)

Open rui-mdias opened this issue 1 year ago • 0 comments

Issue Title: Problem exporting BIRT 4.17 report to Excel (page breaks not working)

Description: I am using Knowage version 8.1.26 CE in a Docker environment on OKD and encountered an issue when exporting a BIRT 4.17 report to Excel (xlsx) format. Although the page breaks are properly configured in the report, when exporting to Excel, all tables appear on a single sheet, instead of being split across multiple sheets according to the page breaks.

Additionally, I investigated the BirtReportServlet.java class (path: Knowage-Server-8.1.26\knowagebirtreportengine\src\main\java\it\eng\spagobi\engines\birt) and discovered the cause of the erratic behavior. In the code:

.....
} else if (outputFormat != null && outputFormat.equalsIgnoreCase(IBirtConstants.EXCEL_RENDER_FORMAT)) {
    renderOption = new EXCELRenderOption();
    setMSOfficeEmitterId("xls", renderOption);
    renderOption.setOption("ExcelEmitter.SingleSheetWithPageBreaks", true);
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".xls");
} else if (outputFormat != null && outputFormat.equalsIgnoreCase("xlsx")) {
    renderOption = new EXCELRenderOption();
    renderOption.setOption("excel_native_charts", false);
    setMSOfficeEmitterId("xlsx", renderOption);
    renderOption.setOption("ExcelEmitter.SingleSheetWithPageBreaks", true);
    response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
    response.setHeader("Content-disposition", "inline; filename=" + templateFileName + ".xlsx");
}
...

In both cases (xls and xlsx), the option ExcelEmitter.SingleSheetWithPageBreaks is set to true, which explains the behavior of exporting all tables into a single sheet.

My question is: why aren't the page break settings from the BIRT report being used instead?

Steps to reproduce the issue:

1 - Configure the page breaks in BIRT report. 2 - Import a report created in BIRT 4.17 into Knowage. 3 - Export the report to Excel (xlsx) format. 4 -Check that all tables appear on a single sheet.

Expected behavior: I expected that when exporting the report to Excel, the tables would be separated into different sheets according to the page breaks configured in BIRT.

Environment:

Knowage version: 8.1.26 CE Environment: Docker on OKD Report: BIRT 4.17 Additional information: If more details are needed, I am available to provide examples or further information about the environment.

Thank you for your attention to this issue!

rui-mdias avatar Oct 22 '24 13:10 rui-mdias