SOLVED - Per mille symbol

SOLVED - Per mille symbol

Postby ADutheil » Wed Jul 05, 2017 7:38 pm

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  Expand view
oSheet:Cells( nK, 2 ):value := "‰"


But the cell appears blank. What is the correct way to achieve this?

Thanks
Last edited by ADutheil on Thu Jul 06, 2017 1:46 pm, edited 1 time in total.
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Per mille symbol

Postby Gale FORd » Wed Jul 05, 2017 10:46 pm

What font is Excel using for that cell? Might try different font
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Per mille symbol

Postby ADutheil » Wed Jul 05, 2017 11:11 pm

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.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Per mille symbol

Postby ukoenig » Thu Jul 06, 2017 6:59 am

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

Image

regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Per mille symbol

Postby ADutheil » Thu Jul 06, 2017 11:32 am

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.
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: SOLVED - Per mille symbol

Postby ADutheil » Thu Jul 06, 2017 1:48 pm

Might not be the best way but it works.

Code: Select all  Expand view
HB_SETCODEPAGE( "UTF8EX" )
oSheet:Cells( nK, 2 ):value := HB_UTF8ToStr( "‰" )
HB_SETCODEPAGE( "PTISO" )
 
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil


Return to FiveWin for Harbour/xHarbour

Who is online

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