Page 1 of 1

Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Tue Jul 09, 2013 1:38 pm
by ukoenig
Hello,

from a DBF I show different single Chars in a Excel-sheet
A single char " breaks it.
Is it possible to display "
This char seems to be a problem.
I defined it, to be displayed LARGE in this post.
Nothing happens und still shows a normal size.
Also a color-define doesn't work.

Image

adding Char " breaks the Exel-sheet

Image

Best Regards
Uwe :?:

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Tue Jul 09, 2013 1:49 pm
by ADutheil
Did you try ""?

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Tue Jul 09, 2013 4:13 pm
by Jeff Barnes
You might need to put a single quote in front of it. ( ' )

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Tue Jul 09, 2013 4:37 pm
by ukoenig
I tested with the 2. VKey-table.
It seems only " " as a pair is possible in Excel and are not visible.

Image

Image

Image

Best Regards
Uwe :?:

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Wed Jul 10, 2013 8:03 am
by ukoenig
I found a solution to display a single "

1. I created a extra Excel-function
2. I converted the field " to a extra string using two '

Image

The DATA-part of the Excel-sheet
Code: Select all  Expand view

DBSELECTAREA(1)
DBGOTOP()
DO WHILE ! eof()
    xRange := ltrim(str(nRow))     // Cell
    nRow++
    cChar1 := (1)->CHAR1
    IF cChar1 = '"'
        cChar1 := "''"
    ENDIF   
    cChar2 := (1)->CHAR2
    IF cChar2 = '"'
        cChar2 := "''"
    ENDIF   
    cChar3 := (1)->CHAR3
    IF cChar3 = '"'
        cChar3 := "''"
    ENDIF   
    cChar4 := (1)->CHAR4
    IF cChar4 = '"'
        cChar4 := "''"
    ENDIF   

    oClp:SetText( cChar1 + chr( 9 ) + ;
                (1)->VALUE1 + chr( 9 ) + ;
                cChar2 + chr( 9 ) + ;
                (1)->VALUE2 + chr( 9 ) + ;
                cChar3 + chr( 9 ) + ;
                (1)->VALUE3 + chr( 9 ) + ;
                cChar4 + chr( 9 ) + ;
                (1)->VALUE4 + chr( 9 ) )

    oSheet:Cells( nRow, 1 ):Select()
    oSheet:Paste()
    oClp:Clear()

    DBSELECTAREA(1)
    (1)->( DbSkip() )

    SysRefresh()
 


Best Regards
Uwe :lol:

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Wed Jul 10, 2013 2:25 pm
by nageswaragunupudi
If you are developing your own logic to export to excel, I have no comments.

But if you are using XBrowse to export to Excel:

1. If the browse is an array browse, there is no problem. Single " is exported correctly.

2. If you want to export from a browse of DBF, please set
oBrw:lExcelCellWise := .t.
and the export of single " will be correct.

3. From next version of FWH the export will be fine in all cases.

Re: Single char " from a DBF breaks a Excel-Sheet ?

PostPosted: Wed Jul 10, 2013 3:52 pm
by ukoenig
Mr. Rao,
thank You very much.
Adding this line, has done the job :

oBrw:lExcelCellWise := .t.

Image

Best Regards
Uwe :lol: