FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour The office font
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
The office font
Posted: Fri Nov 07, 2025 10:15 AM

Hi,

The font in the Word table is Times New Roman 12.
In order to create the same font in FW, I do

DEFINE FONT NAME "Times New Roman" SIZE 0, 12

Is this correct ?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: The office font
Posted: Fri Nov 07, 2025 10:22 AM

Dear Yuri,

You should use:

DEFINE FONT NAME "Times New Roman" SIZE 0, -12

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: The office font
Posted: Fri Nov 07, 2025 11:53 AM

Thank you, Antonio!
However, I did not notice the difference -font 12 and font -12 have a height of 10 pixels.
There is some text in the Word cell of the table. If it exceeds the width of the cell, then its height increases. I wanted to find out the number of substrings in a cell like this

nWc:=oTb:Item(1):Columns:Item(1):Width*1.333
ceiling(GetTextWidth(NIL, MyText, oFn:hFont)/nWc)

However, I get a non-linear value :cry:

Posts: 99
Joined: Thu Jul 12, 2007 02:02 PM
Re: The office font
Posted: Fri Nov 07, 2025 04:10 PM

Hi Yuri,

can it help you to know the number of rows?

...
nRows := WdGetNRows( oDoc, 1, 2, 2 )
...

FUNCTION WdGetNRows( oDoc, nTable, nRow, nCol )
	LOCAL   Pos, CellHeight, CellHeight1, nRows, cBuf, nSizeRow
        

    Pos := oDoc:Tables[nTable]:Cell( nRow, nCol ):Range:End - 1
    CellHeight := oDoc:Range( Pos, Pos ):Information( 8 )      // wdVerticalPositionRelativeToTextBoundary 8
                    
    cBuf := LEFT( oDoc:Tables[nTable]:Cell( nRow, nCol ):Range:Text, LEN( oDoc:Tables[1]:Cell( nRow, nCol ):Range:Text ) - 2 )

    oDoc:Tables[nTable]:Cell( nRow, nCol ):Range:Text := cBuf + CRLF
                    
    Pos := oDoc:Tables[nTable]:Cell( nRow, nCol ):Range:End - 1
    CellHeight1 := oDoc:Range( Pos, Pos ):Information( 8 )      // wdVerticalPositionRelativeToTextBoundary 8
                    
    nSizeRow := CellHeight1 - CellHeight

    oDoc:Tables[nTable]:Cell( nRow, nCol ):Range:Text := cBuf

    IF CellHeight == 0
            nRows := IIF( EMPTY( cBuf ), 0, 1 )
    ELSE
            nRows := INT( CellHeight / nSizeRow ) + 1
    ENDIF
RETURN nRows

Massimo

Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: The office font
Posted: Fri Nov 07, 2025 07:29 PM

Thanks, MaxP ! I checked, it doesn't work well for me. I'm quite happy with the GetTextWidth(() function. I think I'm misinterpreting the font of the office on FW.

Continue the discussion