Free Support Forum - aspose.com

Events during Excel.Save

Are there any events that are fired during a save?

My objective is to be able to monitor the progress of a save to show a user how far along in the process they are.

The issue comes from creating very large Workbooks with 40 or more sheets.

Dear John.

Thanks for your consideration.

Currently this feature is not available. I will think about your needs.

My rough idea is: provide an event, fire it at start/end, after saving each sheet. How do you think about it.

Now I have many works on hand. So I am afraid that this feature cannot be availble very quickly. When will you need this feature?

It is my understanding that the excel object is saved in a single method call. How can I save one sheet at a time?

Dear John,

Thanks for your consideration.

Yes, file is saved in a single call.

My meaning is that if I design an Save Event for you, there are two ways to do it.
First, when you call Excel.Save method, this event is fired just once.
Second, when you call Excel.Save method, this event will be fired several times, in start/end and at the start of saving each sheet.

I think the second way can provide more information on the progress of saving. But it will trigger an event serveral times in a single call, which may cause confusion.

I have not made the final decision.

I suggest you just call event SaveProgress (not Save) and pass some parameter indicating what part is being saved and approximately percentage of total job done. This should cover John’s needs hopefully.

In this case John can display a progress form which can show a caption, something like “Saving worksheet ‘Sheet Name’” and update a progress bar control.

I imagine that is is tough to predict the total job time.

The following would work for me:

SaveProgress(sender as object, e as AposeExcelSaveEventArgs)

where AposeExcelSaveEventArgs carries the SheetName and a SheetRow number.

Then have two properties on the Excel object:

ExcelSaveEventTrigger as integer (eSaveEventTriggerOptions) (defaults to None = 1)
ExcelSaveEventTriggerSeconds as integer (default = 20)

The Enum for eSaveEventTriggerOptions would be
None = 1
Sheet = 2
Seconds = 4
so you can also pass (Sheet + Seconds) to ExcelSaveEventTrigger

With the Sheet and SheetRow in the eventargs, the programmer should be able to figure out how far along in the process that the method is.

Regards,

– John

Yesterday

We are using FarPoint now. A complexe save takes forever.

Hi, another suggestion to Laurence.

You can compare speed of Aspose.Excel and MS Excel when saving and if they are very different, you can try and optimize performance of save operation. When it becomes quicker maybe you don’t even need to introduce events. Although progress still might be usefull - MS Excel shows a progress bar when saving.

I used AQTime. It is a very good tool. It takes some time to get used to, but I think it is worthwhile. I can even do one or two performance tests for you and post you results back so you can see what functions must be reworked first to improve performance. I used this tool to make sure Aspose.Recurrence calculates dates of occurrences fast.

Dear Roman,

Thanks for your suggestion.

I have done a rough test. If to save a same large excel file, Aspose.Excel is quicker than MS Excel.

Meanwhile, Performance is important for Aspose.Excel. So I am very interested with AQTime and I will have a try. If I have questions on AQTime, I may ask you for help.

Thanks again for your help.