I’m trying to create a button which could export excel format with data from my database (It’s like export feature on your model table, but just without a table).
So my questions are: Does cuba support to do that thing? And if it does, how can I do it (even a trick is ok)?
I guess the best option is to use the Report add-on, but there are some other options:
Use Apache Poi library directly and export workbook with ExportDisplay bean. This is what ExcelExporter does. You can find examples there (ExcelExporter).
In the controller or service map loaded data to the entity (persistent or non-persistent). Create table and CollectionContainer with loaded data and export this table. Demo project: fexport.zip (83.8 KB)
The second option is what I’m looking for. One more thing is if we dont use entity classes, how the code will be look like? Can you please give me some more example for this?
Because I aim to get data from db using native query, so entity classes may not be invoked.
Thank you!