Jump to content


Photo

Error Loading .csv-file


  • Please log in to reply
5 replies to this topic

#1 Toto

Toto
  • Members
  • 3 posts

Posted 11 March 2016 - 04:03 PM

Hi there,

 

I'm using the free version 5.9.75 of NextGrid in D6.

I have a very simple project with just one TNextGrid on the main form.

 

When I try to load a .csv-file with

 

ng.LoadFromTextFile('FromExcel.csv',';');

 

I get a "Cell out of Bounds (0, 0)" exception.

 

The .csv-file was generated with MS Excel 2010, its just a few rows of some random text.

In Notepad++ the file appears totally normal.

 

What am I missing? What is the trick? :blink:

 

TIA

Toto



#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 11 March 2016 - 04:32 PM

Hi Toto,

Can you maybe send me sample of your file? This would help.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#3 Toto

Toto
  • Members
  • 3 posts

Posted 11 March 2016 - 05:14 PM

Hi Boki,

 

well, the file really isn't that special. I had to rename it to .txt in order to load it up here. .csv was not allowed.

Attached File  FromExcel.txt   1.03KB   3 downloads



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 11 March 2016 - 05:18 PM

Hi,

Now thinking, it may be that you didn't already added Columns into grid.

Columns must be added first since CSV file doesn't know about type of column etc.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.

#5 Toto

Toto
  • Members
  • 3 posts

Posted 11 March 2016 - 05:39 PM

Ah, I see. Well, I expected the Load-Method to take care of the proper number of columns. (The source is not included in the free D6 version.)

So I have to analyze the file myself and create the needed colums before loading, very well, no problem.

Thanks a lot, Boki



#6 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 11 March 2016 - 05:43 PM

Hi,

Yes, it will be also problem to store column types, properties etc. in one file.

There are also Save/LoadFromINI for column data.
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users