Closed adiopdn closed 2 years ago
I did add a bit of code to show how the excel file can be generated dynamically. If you look on the generate() method of XLSXGenerator, you will see that it accepts any list of Strings and then these Strings are referenced on the XLSXTemplateController constructor to be added to the generated .xlsx file.
Going by your example, the list of Strings on my code could then be a list IDs of contacts that the user wants to export. Next, an implementation could be made on the XLSXTemplateController to query the Contact data of the IDs that were provided. Finally, the Contacts data can be called from the page template to be added on the generated .xlsx file.
Hope this helps!
ok thanks, let me try it.
so I'm on it, I have just a question: If i already have the list of Contact on the client side i have just to use the list of contact as the textList or i need a wrapper?
hi, I managed to create the document but when I download it it asks me to repair it before opening it. how can i fix it? Thanks
so I'm on it, I have just a question: If i already have the list of Contact on the client side i have just to use the list of contact as the textList or i need a wrapper?
This really depends on how you want to implement it. But I suggest keeping it simple since the XLSXGenerator class passes parameters to the TemplateController class through URL parameters so you'll have to keep in mind the character limit of URLs. For example, instead of sending list of Contact objects, you can just send a list of Contact IDs. You can then query the whole Contact objects using the list of IDs on the TemplateController class.
hi, I managed to create the document but when I download it it asks me to repair it before opening it. how can i fix it? Thanks
There's probably an issue on the .xlsx file that was generated. Open the file using a file archiver program like 7-zip and look around. Most likely, the issue would be on the \xl\worksheets\sheet1.xml so try to check that file first.
Closing this. Let me know if you encounter additional issues.
hello i want to use your repo to export data from Salesforce by apex dynamically but i thought all you do is static. How can i get the data dynamically like exporting contacts data? Thanks in advance.