Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Nattable Export Excel Report contains filter string also( Nattable Export Excel Report contains filter string also)
Nattable Export Excel Report contains filter string also [message #1722142] Wed, 03 February 2016 04:54 Go to next message
Vasanth Arumugam is currently offline Vasanth ArumugamFriend
Messages: 2
Registered: August 2013
Junior Member
Hello Dirk/Team,

Trying to use the nattable excel export functionality, working perfect.

Got two queries, please asssit

1. I Use a FilterRowHeaderComposite (Excel Text Box type filter) in my table. So, if I filter a column with some string (say, xyz) and do an export, then the report contains filter string as well (xyz).

Is there a way to hide the filterrow (Or need to override and customize)?

2. I beleive XSSF support is not there, this has to be performed by ourselves. But is there a way, we can hide the error pops up when a generated excel report is opened?

Error : The file format and extension don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?
<<I got some of your answers related to the 2 question, so you can ignore the 2nd question>>

[Updated on: Wed, 03 February 2016 04:56]

Report message to a moderator

Re: Nattable Export Excel Report contains filter string also [message #1722183 is a reply to message #1722142] Wed, 03 February 2016 09:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
The simplest way to achieve this would be to hide the filterrow prior exporting and showing it after the export again. This way the filterrow would not be exported.

To do this you need to create and register a custom ExportAction that triggers the ToggleFilterRowCommand before and after the ExportCommand.

If anybody comes across this post for the second mentioned issue, the solution is to use the Apache POI extension of NatTable.
Re: Nattable Export Excel Report contains filter string also [message #1763889 is a reply to message #1722183] Mon, 22 May 2017 15:11 Go to previous messageGo to next message
Christian Mohr is currently offline Christian MohrFriend
Messages: 34
Registered: June 2012
Member
Somehow iam not able to get this to work. The Exporter seems to wait for my Action to finish, before it starts the actual export. Thus the FilterRow is visible again.

To reproduce it, i used the _6031_GlazedListsFilterExample, added the export Button from _771_ExcelExportExample and added changed the SelectionAdapter to following:
natTable.doCommand(new ToggleFilterRowCommand());
natTable.doCommand(new ExportCommand(natTable.getConfigRegistry(), natTable.getShell()));
natTable.doCommand(new ToggleFilterRowCommand());


I also tried the register the CustomExportAction as suggested. That didn't work neither. Manually hiding the FilterRow (F3) and then Export works fine.

Do you have any suggestions how to wait for Exporter to finish before showing the FilterRow again?

Re: Nattable Export Excel Report contains filter string also [message #1764132 is a reply to message #1763889] Thu, 25 May 2017 15:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
IIRC you need to execute the ExportCommand without a shell. This way it is executed in the main thread and not in a background thread.
Re: Nattable Export Excel Report contains filter string also [message #1764376 is a reply to message #1764132] Mon, 29 May 2017 09:45 Go to previous messageGo to next message
Christian Mohr is currently offline Christian MohrFriend
Messages: 34
Registered: June 2012
Member
Thanks for the hint. I found the Javadoc of the NatExporter explaining it:

     * @param shell
     *            The {@link Shell} that should be used to open sub-dialogs and
     *            perform export operations in a background thread. Can be
     *            <code>null</code> but could lead to
     *            {@link NullPointerException}s if {@link IExporter} are
     *            configured, that use a {@link FileOutputStreamProvider}.


Sadly all ExcelExporter use the FileOuputStreamProvider. The Shell is used to open additional Dialogs (e.g. SaveDialog) and to determine if the export operations should be perfomed in a background thread or not. Maybe the latter could be made configurable, independent of the shell?


Shall I open a bug/feature request to make the (a)sync execution configurable?
Re: Nattable Export Excel Report contains filter string also [message #1764388 is a reply to message #1764376] Mon, 29 May 2017 10:20 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2614
Registered: July 2012
Senior Member
Feel free to do so
Re: Nattable Export Excel Report contains filter string also [message #1765301 is a reply to message #1764388] Thu, 08 June 2017 09:10 Go to previous message
Christian Mohr is currently offline Christian MohrFriend
Messages: 34
Registered: June 2012
Member
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=517984
Previous Topic:Text Filter column doesn't work
Next Topic:"Interrupted Selection" creates Multiselection effect
Goto Forum:
  


Current Time: Sat Sep 22 05:40:32 GMT 2018

Powered by FUDForum. Page generated in 0.02431 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top