Alaska Software Inc. - change the font of an entire word document
Username: Password:
AuthorTopic: change the font of an entire word document
Hans Jelderschange the font of an entire word document
on Tue, 27 Jul 2010 00:44:31 +0200
I want to change the font of an entire word document.

If you do this by hand in a word document you press Ctrl+A and then select 
the fontname you want in the dropdownbox.

If you look it up in the VB reference file you get:
    Set myRange = Selection.Range
    myRange.WholeStory
    myRange.Font.Name = "Arial"

Does anybody know the code for this in xbase++?
Joe Carrick Re: change the font of an entire word document
on Mon, 26 Jul 2010 20:27:29 -0700
Perhaps XbpFontDialog() or XbpFont() will guide you in the right direction.

On 7/26/2010 3:44 PM, Hans Jelders wrote:
> I want to change the font of an entire word document.
>
> If you do this by hand in a word document you press Ctrl+A and then 
> select the fontname you want in the dropdownbox.
>
> If you look it up in the VB reference file you get:
>    Set myRange = Selection.Range
>    myRange.WholeStory
>    myRange.Font.Name = "Arial"
>
> Does anybody know the code for this in xbase++?
Andreas HerdtRe: change the font of an entire word document
on Tue, 27 Jul 2010 09:19:36 +0200
Hi Hans,

Hans Jelders schrieb:
> I want to change the font of an entire word document.
> 
> If you do this by hand in a word document you press Ctrl+A and then 
> select the fontname you want in the dropdownbox.
> 
> If you look it up in the VB reference file you get:
>    Set myRange = Selection.Range
>    myRange.WholeStory
>    myRange.Font.Name = "Arial"
> 
> Does anybody know the code for this in xbase++?

If the question is on how to translate VB code to Xbase++ code, there is
a ActiveX introduction in the Xbase++ documentation. Refer to the section
"Programming Guide".

The VB to Xbase++ translation looks like this:

=========================== snip ========================
    oRange := oSelection:Range
    oRange:WholeStory()
    oRange:Font:Name = "Arial"
=========================== snap ========================

I think I have found another way to have the same result with
one line of code. Here is a complete sample:

============================ snip =======================

#pragma library( "ascom10.lib" )

PROCEDURE Main()
    LOCAL oWord, oRange, oDocument, oSelection

    oWord := GetObject(,"Word.Application" )
    oWord:visible := .T.
    oWord:Documents:Add()
    oDocument := oWord:ActiveDocument

    oSelection := oWord:Selection
    oSelection:TypeText( "Change font to Arial" )

    oRange := oSelection:Range
    oRange:WholeStory()
    oRange:Font:Name = "Arial"

    wait "Hit key to proceed"

    oSelection:TypeText( "Change font to Courier" )
    oDocument:Content:Font:Name := "Courier"

    wait "Hit key to finish"

    oWord:quit()
RETURN

============================== snap ==========================

Hope this helps.

With my best regards,

   Andreas Herdt
   Alaska Software

--------------------------------------------------------------------

Technical Support:      support@alaska-software.com

News Server:            news.alaska-software.com
Homepage:               http://www.alaska-software.com
WebKnowledgeBase:       http://www.alaska-software.com/kbase.shtm

Fax European Office:    +49 (0) 61 96 - 77 99 99 23
Fax US Office:          +1 (646) 218 1281
--------------------------------------------------------------------
Hans JeldersRe: change the font of an entire word document
on Wed, 04 Aug 2010 00:46:25 +0200
Thanks Andreas. It works.

"Andreas Herdt" schreef in bericht 
news:440852d9$63c42c7c$3809f@news.alaska-software.com...
> Hi Hans,
>
> Hans Jelders schrieb:
>> I want to change the font of an entire word document.
>>
>> If you do this by hand in a word document you press Ctrl+A and then 
>> select the fontname you want in the dropdownbox.
>>
>> If you look it up in the VB reference file you get:
>>    Set myRange = Selection.Range
>>    myRange.WholeStory
>>    myRange.Font.Name = "Arial"
>>
>> Does anybody know the code for this in xbase++?
>
> If the question is on how to translate VB code to Xbase++ code, there is
> a ActiveX introduction in the Xbase++ documentation. Refer to the section
> "Programming Guide".
>
> The VB to Xbase++ translation looks like this:
>
> =========================== snip ========================
>    oRange := oSelection:Range
>    oRange:WholeStory()
>    oRange:Font:Name = "Arial"
> =========================== snap ========================
>
> I think I have found another way to have the same result with
> one line of code. Here is a complete sample:
>
> ============================ snip =======================
>
> #pragma library( "ascom10.lib" )
>
> PROCEDURE Main()
>    LOCAL oWord, oRange, oDocument, oSelection
>
>    oWord := GetObject(,"Word.Application" )
>    oWord:visible := .T.
>    oWord:Documents:Add()
>    oDocument := oWord:ActiveDocument
>
>    oSelection := oWord:Selection
>    oSelection:TypeText( "Change font to Arial" )
>
>    oRange := oSelection:Range
>    oRange:WholeStory()
>    oRange:Font:Name = "Arial"
>
>    wait "Hit key to proceed"
>
>    oSelection:TypeText( "Change font to Courier" )
>    oDocument:Content:Font:Name := "Courier"
>
>    wait "Hit key to finish"
>
>    oWord:quit()
> RETURN
>
> ============================== snap ==========================
>
> Hope this helps.
>
> With my best regards,
> -- 
>   Andreas Herdt
>   Alaska Software
>
> --------------------------------------------------------------------
>
> Technical Support:      support@alaska-software.com
>
> News Server:            news.alaska-software.com
> Homepage:               http://www.alaska-software.com
> WebKnowledgeBase:       http://www.alaska-software.com/kbase.shtm
>
> Fax European Office:    +49 (0) 61 96 - 77 99 99 23
> Fax US Office:          +1 (646) 218 1281
> --------------------------------------------------------------------