Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Get DocumentProperties without opening the file

 Post Reply Post Reply
Author
Baurand Guillaume View Drop Down
New Member
New Member
Avatar

Joined: 11 Aug 2011
Posts: 2
Post Options Post Options   Quote Baurand Guillaume Quote  Post ReplyReply Direct Link To This Post Topic: Get DocumentProperties without opening the file
    Posted: 13 Nov 2012 at 4:34am
Hi,

We use flexcel in a migration process which involves a lot of massive Excel files (both .xls and .xlsx).
This process is based on a version number stored in the excel file itself. 
Basically, if the version number indicates that the file is up to date, nothing is done, otherwise the upgrade of the file structure is performed.

Our problem is that most files are up to date, and reading the version number is a very heavy process because it requires to fully open the Excel file. This creates a huge unecessary overhead in our process.

To solve this, we would like to store the version number in the DocumentProperties, but the Flexcel API still requires to load the document to read the DocumentProperties.
We tried DsoFile.dll, but the 64 bits compatibility problems are a show stopper for us.

In there a way we could access DocumentProperties without actually opening the whole Excel file ( static method ?). Is it something that could be added to the API ?

Thanks

Guillaume Baurand 
Back to Top
Adrian Gallero View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 1237
Post Options Post Options   Quote Adrian Gallero Quote  Post ReplyReply Direct Link To This Post Posted: 13 Nov 2012 at 5:31am
Hi,
I think it could be added to the API yes, we will see if it is possible. On the other hand, what you could do is to use "Virtual Mode" and set the next sheet to null so sheets aren't read:

 public void OnStartReading(object sender, VirtualCellStartReadingEventArgs e)
  { 
     e.NextSheet = null;
}

(take a look at the "Virtual mode" demo for more information). You might even use a sheet in the Excel file to store the version, and read only that sheet using Virtual mode, if you prefer this to setting the version in the properties.

Could this work for you?  You can run the virtual mode demo with your files, selecting a single sheet (and the checkbox "only first 50 rows") to see if the speed is enough before coding it yourself, but I think it will be. 

Regards,
   Adrian.
Back to Top
Baurand Guillaume View Drop Down
New Member
New Member
Avatar

Joined: 11 Aug 2011
Posts: 2
Post Options Post Options   Quote Baurand Guillaume Quote  Post ReplyReply Direct Link To This Post Posted: 13 Nov 2012 at 6:23am
Hi

Thanks a lot for your quick reply. We'll dig into this to see if it could be a solution.

Nevertheless, adding a direct access to the DocumentProperty would be an much appreciated feature if I judge by the number of projects relying on the quircky Dsofile solution to do this.

Thanks

Guillaume

Back to Top
Adrian Gallero View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 1237
Post Options Post Options   Quote Adrian Gallero Quote  Post ReplyReply Direct Link To This Post Posted: 13 Nov 2012 at 6:39am
Yes, we will see if we can add some direct support too. It is just that we have a lot of things on our plate right now (we are working in full conditional formatting support, native winrt, native wpf, winphone8 and monotouch right now).
And every feature, as small as it can be, means testing it, supporting, maintaining it.

So while it would indeed be nice, it is still possible to read properties with dsofile, and for small files it isn't a problem to read the whole file. But it is not possible to use flexcel in winrt right now. Also because of demand, winrt gets priority. But after we ship 6.0, we will try to add this support. (if there isn't anything new that gets more priority).

But as this can take a while, I think looking at virtual mode is the best bet now.  
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down