Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rui-mdias opened this issue Oct 22, 2024 · 6 comments
Labels

Comments

@rui-mdias
Copy link

rui-mdias commented Oct 22, 2024

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!

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Nov 22, 2024
@Redjaw Redjaw removed the Stale label Nov 22, 2024
@rui-mdias
Copy link
Author

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
Copy link
Contributor

Redjaw commented Nov 22, 2024

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

@rui-mdias
Copy link
Author

Hello,

I made the change in a fork of Knowage, and it worked correctly.
The page breaks were applied properly because my BIRT reports are configured to perform page breaks per table.
After declaring a table or another object that we want to separate onto a new page, the following property must be set in the BIRT report:

<property name="pageBreakAfter">always</property>

Thank you

Copy link
Contributor

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.

@github-actions github-actions bot added the Stale label Dec 27, 2024
Copy link
Contributor

github-actions bot commented Jan 1, 2025

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as completed Jan 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants