Recent

Author Topic: problem writing xls file  (Read 10070 times)

nicola69

  • New Member
  • *
  • Posts: 15
problem writing xls file
« on: February 19, 2013, 03:57:55 pm »
Hi
My lazarus version is 1.06 , fpc 2.6.0 , cpu icore 5 and my so is windows xp 32 bit.
I use sqlite as db.

I write a simple application that read a file csv , search some data in a sqlite db and write data in excel in 2003 format
I use FPSpreadsheet .

My problem is when I try to read a file with more than 5600 row and the excel file is the same height , my program generate excel file (.xls)  but excel 2007 don't read file and tell me that is corrupt.  i tried open with libre office 4 but i have the same problem.

Could someone help me ?

Thank you very much.

you could download project file from

https://dl.dropbox.com/u/64726031/project%20exported.zip

exe compiled for win 32 and sqlite db file and sqlite3.dll

https://dl.dropbox.com/u/64726031/exe.zip

and a txt sample

https://dl.dropbox.com/u/64726031/sample%20file%20txe.zip

If you want try my program with sample txt file you have to push first button "Carica Dati ftp e Genera Excel"
you have to select txt inside sample file txe.zip
After few minutes my program ask you where save xls file.

I read another thread

http://www.lazarus.freepascal.org/index.php/topic,16716.15.html

I think that I have same problem but i have download last version of lazarus.  Where i can see if my revision in more than 2454.

Another question

Can I save in ooxml format and it compatible with excel 2007 ?











 
« Last Edit: February 20, 2013, 04:13:04 pm by nicola69 »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: problem writing xls file
« Reply #1 on: February 20, 2013, 07:45:23 am »
Thanks for posting detailed info.

Haven't looked at your application yet.

Note that the version of fpspreadsheet is independent of Lazarus as fpspreadsheet is not bundled with Lazarus.
Please first try to use the newest development version of fpspreadsheet or the recently released (January) new version:
http://wiki.lazarus.freepascal.org/FPSpreadsheet#Latest_release

Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: problem writing xls file
« Reply #2 on: February 20, 2013, 09:25:53 am »
Fiddled some with the program; LibreOffice shows an empty file (if saved as .xls) even if only 400 lines are saved....
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

nicola69

  • New Member
  • *
  • Posts: 15
Re: problem writing xls file
« Reply #3 on: February 20, 2013, 03:55:35 pm »
BigChimp
i have donwloaded lasted svn from sourcefourge (1.1)
but there is same problem  excel with more 5600 are saved in a wrong file format.


BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: problem writing xls file
« Reply #4 on: February 20, 2013, 04:07:39 pm »
Well, as I said, with the latest fpspreadsheet, I couldn't even get 400 rows to save correctly. Maybe I modified your program too much while looking at it....
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

mica

  • Full Member
  • ***
  • Posts: 196
Re: problem writing xls file
« Reply #5 on: February 20, 2013, 06:25:45 pm »
i work with this to create excel files

http://avemey.com/zexmlss/index.php

wp

  • Hero Member
  • *****
  • Posts: 13327
Re: problem writing xls file
« Reply #6 on: February 20, 2013, 10:17:12 pm »
I am using Lazarus 1.1/fpc 2.6 and the latest fpSpreadsheet, both from svn. If I use the excel5write or excel8write demos and add these lines

Code: [Select]
  for i:=1 to 60000 do
    MyWorksheet.WriteUTF8Text(i, 0, 'Hallo');

the programs create a file that Excel can read without issues. You can't go up beyond line 65536 however, there is still an integer bug in the cell addresses that I reported some time ago, but which obviously has not yet been fixed.

Are you sure that your fpspreadsheet is from http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/fpspreadsheet/?

grandehombre

  • New Member
  • *
  • Posts: 42
Re: problem writing xls file
« Reply #7 on: July 02, 2013, 01:09:53 pm »
(as per forum hint, I have created a new post, called 'Excel 2010 cannot read large(ish, 8MB) files created by fpspreadsheet')

http://forum.lazarus.freepascal.org/index.php/topic,21389.0.html
« Last Edit: July 02, 2013, 01:23:59 pm by grandehombre »
Lazarus v1.2RC2  i386-win32-win32/win64,  FPC v2.6.2, svn43696 on Win7-64 and win8.1

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12592
  • FPC developer.
Re: problem writing xls file
« Reply #8 on: July 02, 2013, 01:24:37 pm »

the programs create a file that Excel can read without issues. You can't go up beyond line 65536 however, there is still an integer bug in the cell addresses that I reported some time ago

Is it really a bug, or simply a limit of the format version that is being written? Older Excels did have such limit IIRC

grandehombre

  • New Member
  • *
  • Posts: 42
Re: problem writing xls file
« Reply #9 on: July 02, 2013, 01:27:43 pm »
Hi,

The limit that comes to mind is the 65535 row limit of earlier Excel versions...
In the case I am describing (8MB file, 9000 rows) that limit is quite a distance away...
Additionally, the 9000 rows do not seem to matter as much as the amount of data written:
9000 rows of 4 colums generates a smaller file that works
9000 rows of 8 colums generates an 8MB file that fails

Cheers,
Nick
Lazarus v1.2RC2  i386-win32-win32/win64,  FPC v2.6.2, svn43696 on Win7-64 and win8.1

wp

  • Hero Member
  • *****
  • Posts: 13327
Re: problem writing xls file
« Reply #10 on: July 02, 2013, 01:36:19 pm »
Quote
Is it really a bug, or simply a limit of the format version that is being written? Older Excels did have such limit IIRC
Older versions yes, but from 2007 on they accept more (http://wiki.answers.com/Q/How_many_rows_and_columns_are_there_in_Excel). My comment above was only partially correct because the excel8demo does not write an Excel 2007 file. But fpspreadsheet has the same limitation for ooxml files while the max row count is higher.

 

TinyPortal © 2005-2018