KnowageLabs / Knowage-Server

Knowage is the professional open source suite for modern business analytics over traditional sources and big data systems.
http://www.knowage-suite.com
GNU Affero General Public License v3.0
406 stars 221 forks source link

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

Open rui-mdias opened 1 month ago

rui-mdias commented 1 month ago

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!

github-actions[bot] commented 1 day ago

This issue is stale because it is related to an old version or it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

rui-mdias commented 18 hours ago

Hello, I can confirm that this issue also occurs in the latest versions. Please let me know if any additional details or logs are needed to help investigate further.

Thank you

Redjaw commented 16 hours ago

Hello, the option you highlighted has been set in the past as a workaround because the xls emitter was dividing the data in a wrong way. Removing it for all exports will recover the issue. Is there some birt specific property we can point at?

Thank you