Reporting module support for xlsx templates

Is there a plan to make reporting module to support xlsx templates (Excel 2007 and above)?

@carapai, the intention is for this to be supported. If this is no longer working (or perhaps never correctly worked), please raise a ticket. My hope it that it would be a relatively minor fix to this method here.

Mike

@mseaton Did this get fixed? I really need to support Excel 2007 and above. This is the error I get when I attempt to use it https://pastebin.com/tB5NPCcM cc @carapai @ssmusoke

@ningosi, I don’t think a ticket was ever created. As you can see from the method I indicated above, it is intended to work.

Mike

@mseaton yah! that is what this line says. Is there anything I need to do in my design to make it work and NOT pop up that error?

@mseaton So I stumbled at this. Does it mean if it gets something like this yyyyy.xlsx it will be renamed as yyyy.xlsx.xls That could be where the confusion is.

@ningosi, I thought your problem was in loading of the Excel template, not in writing it out or trying to open a rendered report (see your stack trace).

Based on your stack trace, the right line of code is being called to attempt to load this template as an xlsx file. Where exactly are you experiencing this issue? Are you setting up reports in code that are then later failing to render properly? Or is this happening when you upload xlsx templates from the admin UI?

If it is happening after you set things up in code, my guess is that your template is getting corrupted along the way. Often this will happen if you are doing resource filtering during the maven build process and you are not limiting this to the appropriate types of files. One way to confirm whether this is indeed the case, is to build your module with maven as normal, and then go into target/classes and find the xslx file that you are trying to set up in the compiled class folder. If you try opening this here and it fail to open due to some corruption, then you know the issue is in the build process and not with the reporting module itself.

Give it a go and let me know how you end up.

Mike

Thanks @mseaton let me give it a try then will revert back. Generally, am setting up reports in code that are then later fail to render properly when I specify excel as an output. Note that only this happen with file extension .xslx but renders as required with .xls

@ningosi, can you share which module this is happening in? I’d like to see where your xslx resource is, and have a look at your pom.

Thanks @mseaton just confirmed that my .xlsx file cannot be opened as you specified above(could be corrupted) anyway the code am working on is here the builder and this is where am calling my template and the template resides here

@ningosi, your issue is on lines 125 and 133 here:

As you can see, you are excludiing *.xls files from resource filtering, but you are not excluding *.xslx files.

Personally, I choose to take more of an opt-in approach to resource filtering, choosing only to include properties, xml, and txt files - this way it is clear that this is supported in text files, but will not slip into binary files inadvertently. You can see how I have done this here.

1 Like

Thank you very much. I just got sorted out, am good to go

Hey @mseaton, sorry for disturbance, after correcting the filtering, I tried again but this time round it resulted into https://pastebin.com/GMwYf1Et. What do you think could cause that?

@ningosi, I’m not sure why that is happening, but it is getting thrown from a log.debug statement. Try removing that logging statement and see if that fixes things…

Thanks @mseaton is this what I should remove? Seems that is where the error is being reported

@ningosi, no you need to look further up the stack trace. Line 262.

@mseaton after commenting out that line in reporting framework, the error disappears but the contents are not rendered on the excel sheet and something funny, other version of excel fail too. Would you have time and test to render with a .xlsx template?

@ningosi, if you can code up a unit test that loads an xlsx template and tests that it can be used by the Excel Template Renderer (or show that this fails), and issue a pull request for this, I’m happy to try to run this myself and see what I can find out. You should be able to simply add one or more tests to the existing ExcelTemplateRendererTest.

Mike