Page 1 of 1
SOLVED - Per mille symbol
Posted: Wed Jul 05, 2017 7:38 pm
by ADutheil
To all
I am trying to use the per mille symbol in an Excel cell but it does not work. My code is:
Code: Select all
oSheet:Cells( nK, 2 ):value := "‰"
But the cell appears blank. What is the correct way to achieve this?
Thanks
Re: Per mille symbol
Posted: Wed Jul 05, 2017 10:46 pm
by Gale FORd
What font is Excel using for that cell? Might try different font
Re: Per mille symbol
Posted: Wed Jul 05, 2017 11:11 pm
by ADutheil
I'm using Calibri, but I don't think it's a font problem because I can paste the symbol once the table is ready.
Re: Per mille symbol
Posted: Thu Jul 06, 2017 6:59 am
by ukoenig
I added the symbol without any problem
I used EXCEL2.prg from samples
#include "FiveWin.ch"
function Main()
local oExcel := CreateObject( "excel.application" )
local oBook := oExcel:Workbooks:Add()
local oSheet := oBook:Worksheets( 1 )
oSheet:Range( "A1" ):Value = "Last Name"
oSheet:Range( "B1" ):Value = "First Name"
oSheet:Range( "A1:B1" ):Font:Bold = .T.
oSheet:Range( "A2" ):Value = "Doe"
oSheet:Range( "B2" ):Value = "John"
oSheet:Range( "C2" ):Value = "‰"
//oSheet:Cells( nK, 2 ):value := "‰"
oBook:SaveAs( CurDrive() + ":\" + CurDir() + "\Book1.xls" )
oExcel:Visible = .T.
// oExcel:Quit()
MsgInfo( "ok" )
return nil
regards
Uwe
Re: Per mille symbol
Posted: Thu Jul 06, 2017 11:32 am
by ADutheil
The problem is connected to codepage. When I comment HB_SETCODEPAGE( "PTISO" ) at the beginning of my program a character shows up in the cell but it's still not the per mille symbol and the rest of the cells loose all their accents.
Re: SOLVED - Per mille symbol
Posted: Thu Jul 06, 2017 1:48 pm
by ADutheil
Might not be the best way but it works.
Code: Select all
HB_SETCODEPAGE( "UTF8EX" )
oSheet:Cells( nK, 2 ):value := HB_UTF8ToStr( "‰" )
HB_SETCODEPAGE( "PTISO" )