Tsbrowse Exceloel Char Problem

Tsbrowse Exceloel Char Problem

Postby kokookao2007 » Fri Dec 12, 2008 9:39 am

hi Everyone:

In TsBrowse ,Field value "00431224566" , when oBRW:ExcelOle() to Excel .

Excel Value show 4311224566 , value is Nunber type .

Someone help me How to make it to a Char type ?

Thank you.

--
Best Regards
--------------------------------------------------------------
kokoo KAO
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Re: Tsbrowse Exceloel Char Problem

Postby Detlef Hoefner » Fri Dec 12, 2008 11:20 am

kokookao2007 wrote:hi Everyone:

In TsBrowse ,Field value "00431224566" , when oBRW:ExcelOle() to Excel .

Excel Value show 4311224566 , value is Nunber type .

Someone help me How to make it to a Char type ?

Thank you.

--
Best Regards
--------------------------------------------------------------
kokoo KAO


Kokoo,

try to put a chr( 39 ) before your string.

Code: Select all  Expand view
oSheet:Cells( nRow, nCol ):Value := "'00431224566"


Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby kokookao2007 » Fri Dec 12, 2008 1:47 pm

HI Detlef :

Thank you .
oSheet:Cells( nRow, nCol ):Value := "'00431224566"


Any possiable not to add "'" into the Char to makt it ?

--
Best Regards
--------------------------------------------------------------
kokoo KAO
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am

Postby Detlef Hoefner » Fri Dec 12, 2008 2:06 pm

Kokoo,

you may also try
Code: Select all  Expand view
#define xlLeft         -4131 // (0xhffffefdd)
#define xlRight        -4152 // (0xhffffefc8)
#define xlCenter       -4108 // (0xhffffeff4)


oSheet:Columns( n ):Set( "HorizontalAlignment", xlRight )
oSheet:Columns( n ):Set( "ColumnWidth",  12 )
oSheet:Columns( n ):Set( "NumberFormat", "@" ) // Text format


With this code i set a complete column to text format.
The above code is working.

May be it works with cells too.
Code: Select all  Expand view
oSheet:Cells( nRow, nCol ):Set( "NumberFormat", "@" )
oSheet:Cells( nRow, nCol ):Value := "00431224566"

This code i didn't try.

regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Postby kokookao2007 » Fri Dec 12, 2008 3:00 pm

HI Detlef:

oSheet:Cells( nRow, nCol ):Set( "NumberFormat", "@" )


It is work as what I need.

Thank you.

--
Best Regards
--------------------------------------------------------------
kokoo KAO
User avatar
kokookao2007
 
Posts: 59
Joined: Thu May 17, 2007 8:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 50 guests