"File error" Message when Spreadsheet is Opened

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
bheide
Posts: 2
Joined: Fri Sep 18, 2015 12:36 pm

"File error" Message when Spreadsheet is Opened

Post by bheide »

I am trying to track down the source of a "File error: data may have been lost" message which we see when opening our spreadsheet.

We have used the same code successfully using version 5.20.05 of the XLSReadWriteII5 component in Delphi XE2. We are now moving our development to Delphi XE7 and using version 5.20.59 of the component but are experiencing the error mentioned above.

Basically, our process takes a spreadsheet (having Freeze Panes on the first four rows), we populate specific cells and then we save the results as a new spreadsheet. Cells are altered in both the Freeze Pane range as well as outside of that range. When we open the new spreadsheet, the "File error: data may have been lost" message is displayed by Excel. If you click OK, the message closes and the spreadsheet is displayed, but there are no longer any Freeze Panes in this spreadsheet (the rows are there but now scroll just like everything else).

Using Excel, we just used the "unfreeze panes" option and saved the spreadsheet that is used as our source. The end result was the same. The "File error: data may have been lost" message is still displayed when we open the modified spreadsheet. So it would appear that the Freeze Pane isn't the issue.

While I don't believe the following has any relationship to the message, I will add that the "template" (the source Excel spreadsheet) is stored as a blob in an Interbase database. Our process pulls this "template" spreadsheet out of the database and we modify it before saving our modified results into a different table in the Interbase database. This gives our users an archive of all of their reports. When they want to view a report we extract it from the blob and open it with Excel.

I realize that this isn't a lot of information to go on, but I hope that you can either ask me to provide something more specific or offer suggestions on what we may need to change when using the newer version of the component AND newer version of Delphi.

Thanks in advance for any assistance.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: "File error" Message when Spreadsheet is Opened

Post by larsa »

Hello

Please send me the excel file that you create and I will take a look at it.
Lars Arvidsson, Axolot Data
bheide
Posts: 2
Joined: Fri Sep 18, 2015 12:36 pm

Re: "File error" Message when Spreadsheet is Opened

Post by bheide »

For the benefit of anyone else who might experience this issue I'll update what we have learned...

Working with Lars, we tried saving our files in XLSX format and we don't see the error message.

We looked closer at the problem when saving in XLS format. In our case, the state government provides XLS spreadsheets that we use as a template, loading them up and then updating the appropriate cells before writing them back out. We found that all of the spreadsheets that generated an error after we saved them in XLS format had Freeze Panes. When we removed the Freeze Panes from all of the workbooks within those spreadsheets, we could use the template, make our changes and save a new spreadsheet that could then be opened without receiving the "File error: data may have been lost" message.

Lars, thank you for your help. Hopefully you can find a solution to this that will allow us to save in XLS format since that would be our preferred solution.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: "File error" Message when Spreadsheet is Opened

Post by larsa »

Hello

This is fixed in update 5.20.62
Lars Arvidsson, Axolot Data
Post Reply