FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Limited output Xbrowse to exel or csv (SOLVED)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Limited output Xbrowse to exel or csv (SOLVED)
Posted: Sun Feb 26, 2017 11:25 PM

Hello,

I need to export data into a exel or csv file. (for later import into Prestashop shopsystem)

One field is a memo field (dbt or fpt), that can be large (200-600 chars)

I have a point that I can export to exel from Xbrowse, but I see that exel is limited to 255 char in a colom !
I can us COPY TO update.csv DELIMITED, but also this will only give approx 255 char ?

How can I overcome this limit ?

I need to have 1 large field, since the import module from Presta alows 1 field for each imported field.

Marc

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Limited output Xbrowse to exel or csv
Posted: Mon Feb 27, 2017 11:38 PM
It is possible to export text larger than 255 bytes to Excel.
Code (fw): Select all Collapse
   local aData := { { 1, memoread( "\fwh\samples\testrad3.prg" ) } }

   xbrowser aData

and try exporting from xbrowser. This is working.

But the issue is it is not convenient to view large texts of data in Excel.

Exporting to CSV:

If the source is DBF we can use
COPY TO file.csv DELIMITED
Regards



G. N. Rao.

Hyderabad, India
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Limited output Xbrowse to exel or csv
Posted: Tue Feb 28, 2017 12:19 AM
I tried the sample, and I see that exel will put it on multiple lines. (this could work)

I have to look into it if the import module (php) will correctly use this kind of lines, because I think there will be CTRL into it.
In my program I convert all CTRL into <br> html code for a new line and put all into the memo field.

If the source is DBF we can use
COPY TO file.csv DELIMITED


Partly Sample


Testing software dbftocsv (3th Party)

"14001800";"1";"Werkbroek : 1400";"Algemeen";"1. Broeken";" 33.00";"";"";"";"";"";"";"";"14001800";"";"";"Blaklader";"";"";"";"";"100";"Werkbroek : 1400";"<p><strong>Samenstelling :</strong></p><br>65% polyester, 35% katoen, twill, 240 g/m?<br><p><strong>Gewicht :</strong></p><br>240 g/m?<br><p><strong>Eigenschappen :</strong></p><br>路 Twee insteekzakken. <br>路 Achterzak met knoopsluiting. <br>路 Twee broeks";"";"";"";"";"";"";"";"";"0";"";"Korenblauw";"C148";"";"";"";"";"False";"";"";"";"0";"0";"";"";"<p><strong>Samenstelling :</strong></p><br>65% polyester, 35% katoen, twill, 240 g/m?<br><p><strong>Gewicht :</strong></p><br>240 g/m?<br><p><strong>Eigenschappen :</strong></p><br>路 Twee insteekzakken. <br>路 Achterzak met knoopsluiting. <br>路 Twee broekspijpzakken waarvan een met klep en een met driedelig potloodzakje. <br>路 D-ring. <br>路 Telefoonzakje<br>"

with COPY TO file.csv DELIMITED

"14001800",1,"Werkbroek : 1400","Algemeen","1. Broeken",33.00,"","","","","","","","14001800","","","Blaklader","","","","",100,"Werkbroek : 1400","<p><strong>Samenstelling :</strong></p><br>65% polyester, 35% katoen, twill, 240 g/m?<br><p><strong>Gewicht :</strong></p><br>240 g/m?<br><p><strong>Eigenschappen :</strong></p><br>路 Twee insteekzakken. <br>路 Achterzak met knoopsluiting. <br>路 Twee broeks","","","","","","","","","0","","Korenblauw","C148","","","","",F,"","","",0,0,"","""



Also tried, but the field is also no longer then 255 chars ?

Maybe I have someware limit in files or config files ??

I see that it must be possible, since Uwe has a dbftocsv utility, but there is a lot more of coding done, and he is writing to a file.csv directly.

He shared the function with me, but not possible to get it working for now. (just received)

Thanks already.
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 80
Joined: Tue Mar 25, 2008 09:03 PM
Re: Limited output Xbrowse to exel or csv
Posted: Tue Feb 28, 2017 05:26 PM
Ciao

another method
Code (fw): Select all Collapse
oExcel := CreateObject( "Excel.Application" )
oExcel:WorkBooks:Add()

oAs := oExcel:Activesheet()

oAs:Cells:Font:Name := "Calibri"
oAs:Cells:Font:Size := 11

oAs:Columns( 1 ):ColumnWidth := 17
oAs:Columns( 2 ):ColumnWidth := 150

oAs:Cells( 3, 1 ):Value := "Prog"
oAs:Cells( 3, 2 ):Value := "Note"

n = 1
for n = 1 to 2
聽oAs:Cells(3,n):Borders(7):LineStyle := 1 
聽oAs:Cells(3,n):Borders(8):LineStyle := 1 
next

Use archivio 
go top
n = 4
do while !eof()
sysrefresh()
聽 聽 oAs:Cells( n, 1 ):Value := archivio->c1) 聽 // prog
聽 聽 oAs:Cells( n, 2 ):Value := archivio->c2) 聽 // campo note
聽 聽 n = n+1
聽 聽 skip
enddo

n1 = 1
for n1 = 1 to 2
聽oAs:Cells(n-1,n1):Borders(9):LineStyle := 1 聽
next

oAs:Columns( "A:B" ):WrapText = .T. 

/*
oAs:Name := "NC"
* oAs:Columns( "A:T" ):AutoFit()
oAs:Columns( "A:Z" ):VerticalAlignment := -4108
oAs:Columns( "A:Z" ):HorizontalAlignment := -4108
oAs:Columns( "C:C" ):HorizontalAlignment := -4131
oAs:Columns( "Q:Q" ):HorizontalAlignment := -4131
聽
oAs:Columns( "W:W" ):WrapText = .F. 

oAs:Range("I2:Q2"):color := rgb(184,204,228)
oAs:Range("I3:Q3"):color := rgb(217,217,217)
oAs:Range("A3:H3"):color := rgb(54,96,146)
oAs:Range("A3:H3"):color := rgb(255,255,255)
*/

聽oExcel:visible := .T


Saluti
Stefano
FWH 14.11 + xHarbour + bcc582
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Limited output Xbrowse to exel or csv
Posted: Tue Feb 28, 2017 07:25 PM

Thanks.

Looking into these replys, i noticed that the export from Xbrowse is ok.

Also Exel will except more than 255 char, BUT THE COLOMN IS MAX. 255 LONG. The rest of the data is on the next line, but INSIDE the same row.
I didn't see the data, but the samples above showed a prg in a long row.

Learned samething more about exel !

Sorry for the wrong interpretation of my data :oops:
Thanks for the Effort.

Marc Venken

Using: FWH 23.08 with Harbour

Continue the discussion