Page 1 of 1

Fix for DC_WorkArea2Excel() problem

Posted: Wed Jan 06, 2016 1:44 pm
by rdonnay
Richard Covington reported that his export routine suddenly started erroring in his application.

He uses DC_WorkArea2Excel() to export his DBF data to an Excel worksheet.

His data contains memo fields.
Whenever the contents of a memo field exceeded 1024 characters, it would crash the Excel ActiveX routine.

Here is an updated _DCFUNCT.PRG that now limits memo cells to 1024 characters.

Copy it to your \exp20\source\dclipx folder and run build19_sl1.bat or build20.bat to rebuild DCLIPX.DLL

This fix will be in build 264.

Re: Fix for DC_WorkArea2Excel() problem

Posted: Mon Jan 18, 2016 9:34 am
by Dian
If the entire memo file needs to be in the excel file it is possible to copy the data from the memo field to the excel cell with the following command. Where astruct is the structure of the database table.

oworksheet:=obook:ActiveSheet
SELECT TMPDBF
DBGOTOP()
STORE 2 TO XPOS
DO WHILE !EOF()
FOR I:= 1 TO LEN(ASTRUCT)
IF ASTRUCT[I,2]$'M'
CDATA:=FIELDGET(I)
oWorkSheet:Cells( XPOS,I):Value:=CDATA
ENDIF
NEXT
XPOS++
SKIP
ENDDO

Re: Fix for DC_WorkArea2Excel() problem

Posted: Mon Jan 18, 2016 11:04 am
by rdonnay
it is possible to copy the data from the memo field to the excel cell
Thanks Dian. I will look into this.