javaeclipse-rcpnattable

Using CSV exporter in NatTable


I've ExcelExporter working in my code but I'm not able to utilize CSVExporter along with it.

I have been able to utilize my extended version of ExcelExporter by registering it with extended ExportCommandHandler. But not have been able to utilize the CSVExporter. Does CSVExporter also work on ExportCommand and how to utilize it? If possible please send a reference to examples.


Solution

  • I don't understand what you mean with "I have been able to utilize my extended version of ExcelExporter by registering it with extended ExportCommandHandler". It should not be necessary to create custom command handler.

    Using the CsvExporter is simply done by configuring it via ConfigRegistry like this:

    natTable.addConfiguration(new AbstractRegistryConfiguration() {
        @Override
        public void configureRegistry(IConfigRegistry configRegistry) {
            configRegistry.registerConfigAttribute(
                    ExportConfigAttributes.EXPORTER,
                    new CsvExporter());
    
        }
    });