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

Disable multi-sheet generation in xlsx emitter #645

Closed
SteveSchafer-Innovent opened this issue Apr 24, 2021 · 6 comments
Closed

Disable multi-sheet generation in xlsx emitter #645

SteveSchafer-Innovent opened this issue Apr 24, 2021 · 6 comments
Assignees
Labels
Enhancement Small change to improve the current supported functionality
Milestone

Comments

@SteveSchafer-Innovent
Copy link
Contributor

I have a client that wants to disable multi-sheet generation in the xlsx emitter.

Coincidentally, this bug was just created yesterday: https://bugs.eclipse.org/bugs/show_bug.cgi?id=573117

The spudsoft emitter recognizes a render option "SINGLE_SHEET", which looks like it will do this but I can't find any provision in the viewer to set that option. It would be ideal if this option could be set globally in viewer.properties and also passed as a URL parameter such as __single_sheet=true/false or __xlsx_options=single_sheet/multi_sheet.

Please let me know if this capability already exists and I missed it, or if there's any reason not to implement it as I suggested.

@hvonbargen
Copy link

I don't know, but if it doesn't work with BIRT now, one should have a look at the newer sources of the emitter in my fork hvbtup/BIRT.
And regarding the question in the bug, the 40 (rows) is the default page break for lists and/or tables, so it is correct if the emitter creates a new sheet every 40 records. Unfortunately the maximum value was 9999, maybe this is still the case.
The emitter options can usually be set as user properties, but probably also in other easy. Unfortunately yaytay's bitbucket repository, which also contained documentation, is no longer available.
I'm pretty sure that any emitter option can be set in the URL query, but I don't use it myself, so I don't know exactly this works. Anyway, did you try the exact spelling SINGLE_SHEET=true?

@speckyspooky
Copy link
Contributor

Hello SteveSchafer, there is an option to set this behavior on report level.

If you add on the root element the user property "ExcelEmitter.SingleSheet" (Boolean) and set the value to "true" then you avoid multi-page sheets.
But you have to handle the repeat of header if it is active due to usage on PDF-site.

The spudsoft-Emitter has further additional options which can be set on report root tag based on user properties like "ExcelEmitter.RemoveBlankRows" or "ExcelEmitter.DisableGrouping".

@SteveSchafer-Innovent
Copy link
Contributor Author

I confirmed that speckyspooky's suggestion works. Unfortunately, having to modify all their reports isn't a very good option for my client. I'd still like to implement something at the viewer level. I suspect one sheet per page is undesirable for most people, especially ones that tend to have large reports. Being able to set the default value in viewer.properties would be great.

@speckyspooky
Copy link
Contributor

I'm back with new details. By default there isn't a way to configure the xlsx-Emitter-behavior based on the viewer.properties.
To do this the java-component of the viewer (according property-handling) must be rewritten.

Therefore I used another way to solve your requirement.
You can change the viewer-export dialog directly:
C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\birt\webcontent\birt\ajax\ui\dialo\BirtExportReportDialog.js

In this JS-File is a function definition " __exportAction : function( ) { ... }" and there I added the following sequence to manipulate the URL-call at the moment of export:

__exportAction : function( ) { ...

		// Delete page, pagerange and parameterpage settings in url if existed
		action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGE );
		action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGERANGE );
		action = birtUtility.deleteURLParameter( action, Constants.PARAM_PARAMETERPAGE );
		action = birtUtility.deleteURLParameter( action, Constants.PARAM_EMITTER_ID );

		if( format == "xlsx" ) {
			action = action + "&__ExcelEmitter.SingleSheet=true";
		}

...
}

In my test cases I got only Single-Sheet files with change. Be carefull with this change you haven't directly an Option to get Multi-Sheets. The option on report level won't be work like overwrite, the url settings have higher priority.

@SteveSchafer-Innovent
Copy link
Contributor Author

SteveSchafer-Innovent commented Apr 27, 2021

@speckyspooky thanks very much for this solution. I'm going to try this in 4.8 since that's what my client is using at the moment.

Update: It works. Also the URL parameter works when going directly to xlsx. Due to my dyslexia (which is really lazy reading on my part) I had the parameter name wrong. So this solves the problem for me, and, as far as I'm concerned, it's no longer important to be able to set the default value in viewer.properties. However being able to set render option default values without having to modify the code would still be a valuable feature so I'll leave this issue active.

@wimjongman wimjongman added this to the 4.13 milestone Jan 5, 2023
@wimjongman wimjongman modified the milestones: 4.13, 4.14 Mar 3, 2023
@speckyspooky speckyspooky added the Enhancement Small change to improve the current supported functionality label Nov 4, 2023
@speckyspooky speckyspooky self-assigned this Nov 4, 2023
speckyspooky added a commit that referenced this issue Nov 7, 2023
…ion (#1483)

Enhance of the export viewer dialog to add the excel single sheet option (#645)
@speckyspooky
Copy link
Contributor

The enhancement is included in PR #1483

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Small change to improve the current supported functionality
Projects
None yet
Development

No branches or pull requests

4 participants