Excel Action - set/change file name

How do i set/change the file name of the excel export action for a table ?

The action generated a standard Excel file name but i could not find where the file name is set.

1 Like

Hello, David.

To set the name of the excel file you need to replace the standard excel action with your custom realisation and override the export method. For example:


@Inject
private Table<Customer> customerTable;

@Override
public void init(Map<String, Object> params) {
    customerTable.addAction(new ExcelAction(customerTable) {
        @Override
        protected void export(ExcelExporter.ExportMode exportMode) {
            ExcelExporter exporter = new ExcelExporter();
            exporter.exportTable(table, table.getNotCollapsedColumns(), false, display, null, "custom_file_name", exportMode);
        }
    });
}

Regards,
Gleb.

Thank you.

Hi,

Why not being able to set the name from the studio, or by calling a function action.setFileName(fileName) ?
It would be very useful!

1 Like

Hi,

Thanks for your idea, i’ve created the youtrack issue.

Regards,

Gleb

1 Like

Thank you!

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8934