javanattablenebula

Nebula - Convert a grid into a NatTable


I'm looking to convert a nebula grid into a NatTable. My goal is to be able to generate an excel file automatically using this code :

final ExportCommand cmd = new ExportCommand(natTable.getConfigRegistry(), natTable.getShell());
natTable.doCommand(cmd);

Do you know if it is possible?

Thanks


Solution

  • There is no simple way to convert from an SWT Table, JFace TableViewer or Nebula Grid to a NatTable. They have completely different architectures and designs. The mentioned three implementations use the native OS table, or at least simulate the same, while NatTable is completely custom painted. Another fact is that those three implementations are created column by column, while NatTable uses an IDataProvider that is two-dimensional by design, so there is no column-by-column approach.

    I explained this also in our Getting Started Tutorial.

    So no, there is no simple way to convert. You need to create it from scratch. But that should be no big deal when checking our examples. Well, of course that depends on the features you want to use.