Another Excel-question

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Another Excel-question

Post by driessen »

Hello,

How can I define a tabstop in a Word document in my FWH-application?

Thank you.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
User avatar
alerchster
Posts: 31
Joined: Mon Oct 22, 2012 4:43 pm

Re: Another Excel-question

Post by alerchster »

Code: Select all

#include "FiveWin.ch"

#define wdDoNotSaveChanges                      0

//Tab Alignment
#define wdAlignTabBar               4   //Bar
#define wdAlignTabCenter            1   //Center
#define wdAlignTabDecimal           3   //Decimal
#define wdAlignTabLeft              0   //Left
#define wdAlignTabList              6   //List
#define wdAlignTabRight             2   //Right

//Tab Leader
#define wdTabLeaderDashes           2   //Dashes
#define wdTabLeaderDots             1   //Dots
#define wdTabLeaderHeavy            4   //A heavy line
#define wdTabLeaderLines            3   //Double lines
#define wdTabLeaderMiddleDot        5   //A middle dot
#define wdTabLeaderSpaces           0   //Spaces default


FUNCTION MAIN()
        LOCAL   oWord, oDoc, oSelection

        TRY
                oWord := TOleAuto():New( "Word.Application" )
        CATCH
                oWord := NIL
        END

        IF oWord <> NIL
                oDoc := oWord:Documents:Add()

                oWord:Visible := .T.

                oSelection := oWord:Selection()

                oSelection:TypeText( "This is my text in Word!" )

                //delete tabs
                //Selection.ParagraphFormat.TabStops.ClearAll
                oSelection:ParagraphFormat:TabStops:ClearAll()
                
                //make tabs
                //oSelection:ParagraphFormat:TabStops:Add(Position in Points, Alignment, Leader)
                oSelection:ParagraphFormat:TabStops:Add(100, wdAlignTabLeft, wdTabLeaderSpaces)
                oSelection:ParagraphFormat:TabStops:Add(200, wdAlignTabRight, wdTabLeaderSpaces)
                oSelection:ParagraphFormat:TabStops:Add(300, wdAlignTabDecimal, wdTabLeaderSpaces)


                //oWord:Visible := .F.

                //oDoc:Close( wdDoNotSaveChanges )

                //oWord:Quit()

        ENDIF
RETURN NIL
Regards

Ing. Anton Lerchster
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Another Excel-question

Post by driessen »

Thank you very much.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Post Reply