Recent

Author Topic: Saving Corrupts file  (Read 3566 times)

ceh2624

  • Newbie
  • Posts: 6
Saving Corrupts file
« on: March 17, 2017, 06:06:26 pm »
I have the fpSpreadsheet working in a project which compiles fine.  The problem arises after I save a spreadsheet made my application.  It seems to save without errors, but it is not possible to reopen it.  I set the 'fileSaveAs' and 'fileOpen' dialogs to default to *.ods.  I know 'fileOpen' works because when I create a spreadsheet in Libre Office and save it, It opens in my application just fine, but saving it corrupts the file.
Here is the error message:

Quote
"C:\develop\lazSheet\testNums.ods"
is not a valid spreadsheet file.

Press OK to ignore and risk data corruption.
Press Cancel to kill the program.

Libre Office gives a similar error message when trying to open sheets saved by my fpSpreadsheet application.

Later I will take the project home and compile it on my ubuntu laptop to see what happens there.

Any Ideas???

Cheers
Charles

wp

  • Hero Member
  • *****
  • Posts: 11858
Re: Saving Corrupts file
« Reply #1 on: March 17, 2017, 06:34:56 pm »
The first thing to check would be to see if the file really is an ods file. Maybe you can upload the file here (rename it to extension zip for the forum software to accept it). Or you can check it by yourself: rename the file to  zip extension again and unzip it to a temporary folder. There should be several xml files, among them "content.xml" and "styles.xml". If you see a folder "xl" containing a "workbook.xml" file then the file is probably a falsely-named Excel file. In this case you did not correctly specify the fileformat for writing.

ceh2624

  • Newbie
  • Posts: 6
<Solved> Re: Saving Corrupts file
« Reply #2 on: March 17, 2017, 07:48:39 pm »
Thanks for the answer, wp.  You were on the right track.

The answer came to me as I was eating chicken and rice at a nearby Mexican restaurant.
I reordered the dropdown on the fileSaveAs dialog.  In the fileSaveAsAccept procedure I had a case statement which had the possible formats and I forgot to renumber the items to match the new dropdown configuration.  Once I got the case numbers to match, I was in business.

Cheers
Charles

eny

  • Hero Member
  • *****
  • Posts: 1634
Re: <Solved> Re: Saving Corrupts file
« Reply #3 on: March 17, 2017, 10:53:41 pm »
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

ceh2624

  • Newbie
  • Posts: 6
Re: <Solved> Re: Saving Corrupts file
« Reply #4 on: March 17, 2017, 11:04:05 pm »

 

TinyPortal © 2005-2018