Generate Custom Excel file with dynamic columns

Hi Community

we need to generate a custom excel file but excel reports will not be enough.

Our case, we have a "Article" object, that has a "Category"

and depending on the "Category", this article has certain "ArticleRequirements".

We need to generate and excel file that will have a column header per each "ArticleRequirements"

The "ArticleRequirements" also have a classification A,B and C and ideally I need to separate them into 3 different sheets.

This means that the excel for each article can have a different number of columns.

 

Ex Excel for Product A:

 

Excel for product B:

anyone had a similar case? and any suggestions on how to approach this challenge? 

Some libraries that can be used by Creatio to achieve this?

Thanks

Luis

 

Like 1

Like

1 comments

I did something like this and used the same thing that is used for exporting a list to Excel. Basically, when you export a list to Excel, it takes the ESQ from the list as one big serialized string and then sends it to the ReportService/GetExportToExcelKey service and then it gives back the Excel file. What my custom solution did was to just form my own ESQ string at runtime using the columns I wanted in the Excel file (which varied based on other conditions) and then pass it off to ReportService/GetExportToExcelKey, just as if I was exporting a list. 

For this type of thing to work, the user does need the operation permission for exporting a list to Excel and also, the data in the Excel file does need to be based off of an actual object (meaning not just some random database query) - essentially, as if the data you wanted were bound to a list (even though it's not)

Ryan

Show all comments