Another Excel-question
Posted: Thu Nov 05, 2020 5:38 pm
Hello,
How can I define a tabstop in a Word document in my FWH-application?
Thank you.
How can I define a tabstop in a Word document in my FWH-application?
Thank you.
www.FiveTechSoft.com
https://forums.fivetechsoft.com/
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