Classe Word V 2.0

Classe Word V 2.0

Messagepar oguruma » 19 Oct 2005 à 13:35

Vous trouverez ci-dessous une version 2 de la classe Word
Elle intègre de nouvelles méthodes et propriétés.
Elle permet de gérer plusieurs documents en ligne.
Je vous laisse découvrir ses nouveautés.
Elle est perfectible.
Là où j'ai eu de la misère c'est pour le header et footer de page.
Si quelqu'un a mieux, je suis preneur.

[syntax="ls"]
Public Class WordSession
Private WApp As Variant
Private Documents As Variant
Private Document As Variant
Private ActiveDocument As Variant
Private Windows As Variant
Private Window As Variant
Private ActiveWindow As Variant
Private Selection As Variant
Private Sections As Variant
Private Section As Variant

'//--------------------------------------------------------------------
'// Constructeur
'//--------------------------------------------------------------------
Sub new()
Call CreateSession
End Sub

'//--------------------------------------------------------------------
'// Accès aux propriétés
'//--------------------------------------------------------------------
Function getSelection() As Variant
Set getSelection=Selection
End Function

Function getDocument() As Variant
Set getDocument=Document
End Function

Function getDocuments() As Variant
Set getDocuments=Documents
End Function

Function getActiveDocument() As Variant
Set getActiveDocument=ActiveDocument
End Function

Function getApplication() As Variant
Set getApplication=WApp
End Function

Function getSections() As Variant
Set getSections=Sections
End Function

'//------------------------------------------------------------------
'// Ajout d'un nouveau document
'//-----------------------------------------------------------------
Public Sub AddNewDocument(template As String)
If template="" Then
WApp.Documents.Add
Else
WApp.Documents.Add(template)
End If
Set Documents=Wapp.Documents
Set Windows=WApp.Windows

Call ActivateDocument(Documents.Count)
End Sub

'//--------------------------------------------------------------------------------------------
'// Rend actif le document n ou le dernier document créé
'//--------------------------------------------------------------------------------------------
Public Sub ActivateDocument(n As Integer)
'// A priori ça ne devrait pas se produire, mais ?
If n>Documents.Count Then
Error 9999,"Impossible d'activer le document " & n
End If
If n=0 Then
Error 9999,"Aucun document monté en mémoire"
End If
Set Document=Documents(n)
Document.Activate
Set ActiveDocument=WApp.ActiveDocument
Set Sections=ActiveDocument.Sections
Set Window=Windows(n)
Window.Activate
Set ActiveWindow=Wapp.ActiveWindow
Set Selection=Window.Selection
Windows(n).Activate
End Sub


'//--------------------------------------------------------------------
'// Ouverture d'une session MS Word
'//--------------------------------------------------------------------
Private Function CreateSession() As Variant
On Error Goto CreateSession
'// On tente de récupérer une session existante
'// Si aucune session on l'instancie sur une génération d'erreur
Set WApp = GetObject("", "Word.Application")
CreateSessionOk:
Exit Function
CreateSession:
Err = 0
Print "Création de la session MS Word"
'// Création de la session Word
Set WApp = CreateObject("Word.Application")
'// Si impossible de la créer on force l'erreur
If WApp Is Nothing Then
Error 9999,"Impossibile d'initialiser la session MS Word"
Resume EndCreationSession
End If
Print "Session MS Word initialisée "
'// On sort proprement pour initialiser les objets
Resume CreateSessionOK
EndCreationSession:
End Function

Sub setDisplayAlerts(toggle As Integer)
WApp.DisplayAlerts=toggle
End Sub

Sub setVisible(toggle As Integer)
WApp.Visible=toggle
End Sub

'//--------------------------------
'// Coller
'//--------------------------------
Sub Past()
WApp.Selection.Paste
End Sub

'//---------------------------------------------------------------------------
'// Ajout d'un texte
'//----------------------------------------------------------------------------
Sub AppendText(text As String, newline As Integer)
Selection.TypeText(text)
If newline Then Selection.TypeParagraph
End Sub

'//--------------------------------------
'// Nouvelle ligne
'//--------------------------------------
Sub NewLine(n As Integer)
Dim i As Integer
For i=1 To n
Selection.TypeParagraph
Next
End Sub

'//--------------------------------------
'// Saut page ou de section
'//--------------------------------------
Sub InsertBreak(t As Integer)
Call Selection.InsertBreak(t)
End Sub

'//----------------------------------------
'// Orientation de la page
'//---------------------------------------
'// wdOrientLandscape=1
'// wdOrientPortrait=0
Sub Orientation(o As Integer)
With Selection.PageSetup
.Orientation = o
End With
End Sub

'//---------------------------------
'// Style de texte
'//---------------------------------
Sub Style(sn As Variant)
Selection.Style = sn
End Sub

'/////////////////////////////////////
'// liste des couleurs colorIndex
'// wdAuto
'// wdBlack
'// wdBlue
'// wdBrightGreen
'// wdByAuthor
'// wdDarkBlue
'// wdDarkRed
'// wdDarkYellow
'// wdGray25
'// wdGray50
'// wdGreen
'// wdNoHighlight
'// wdPink
'// wdRed
'// wdTeal
'// wdTurquoise
'// wdViolet
'// wdWhite
'// wdYellow
'////////////////////////////////////////////

'//---------------------------------------
'// ColorIndex
'//---------------------------------------
Sub FontColorIndex(color As Integer)
Selection.Font.ColorIndex = color
End Sub

'//---------------------------------------
'// Fonte
'//---------------------------------------
Sub FontName(n As String)
Selection.Font.Name = n
End Sub

'//-----------------------------------------
'// Taille des caractères
'//-----------------------------------------
Sub FontSize (fz As Integer)
Selection.Font.Size = fz
End Sub

'//--------------------------------------------
'// Gras
'//---------------------------------------------
Sub FontBold(toggle As Integer)
Selection.Font.Bold = Toggle
End Sub

'//------------------------------------------------------
'// Souligné
'//-------------------------------------------------------
Sub FontUnderline(toggle As Integer)
'wdUnderlineDashHeavy
'wdUnderlineDashLongHeavy
'wdUnderlineDotDashHeavy
'wdUnderlineDotDotDashHeavy
'wdUnderlineDottedHeavy
'wdUnderlineNone
'wdUnderlineThick
'wdUnderlineWavyDouble
'wdUnderlineWords
'wdUnderlineDash
'wdUnderlineDashLong
'wdUnderlineDotDash
'wdUnderlineDotDotDash
'wdUnderlineDotted
'wdUnderlineDouble
'wdUnderlineSingle
'wdUnderlineWavy
'wdUnderlineWavyHeavy
Selection.Font.Underline = toggle
End Sub

'//--------------------------------------------
'// Italic
'//--------------------------------------------
Sub FontItalic(toggle As Integer)
Selection.Font.Italic = Toggle
End Sub

'//--------------------------------------------
'// Italic
'//--------------------------------------------
Sub FontColor(color As Integer)
Selection.Font.Italic = color
End Sub

'//--------------------------------------------------------------------------
'// Texte dans un paragraphe
'//--------------------------------------------------------------------------
Function AddTextToDoc(text As String) As Variant
Dim doc As Variant
Set doc=document
Set lastParagraph = doc.Paragraphs(doc.Paragraphs.Count).Range
newRangeStart = lastParagraph.End-1 ' This is where the new text will be placed
Call lastParagraph.InsertAfter(text)
End Function

'//------------------------------------------------------------------
'// Centrage du texte
'//-----------------------------------------------------------------
Sub AlignCenterParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub

'//------------------------------------------------------------------
'// Cadrage à droite
'//-----------------------------------------------------------------
Sub AlignRightParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
End Sub

'//------------------------------------------------------------------
'// Cadrage à gauche
'//-----------------------------------------------------------------
Sub AlignLeftParagraph
Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
End Sub

'//-------------------------------------------------------------------------
'// Gestion des bordures de cadres
'//-------------------------------------------------------------------------
Sub BorderAll(lw As Integer, ls As Integer, t As Integer, b As Integer, r As Integer, l As Integer, ts As Integer)
'wdLineWidth025pt=2, 'wdLineWidth050pt=4
'wdLineWidth075pt=6, 'wdLineWidth100pt=8
'wdLineWidth150pt=12, 'wdLineWidth225pt=18
'wdLineWidth300pt=24, 'wdLineWidth450pt=36
'wdLineWidth600pt=48, 'wdLineStyleDashDot=5
'wdLineStyleDashDotDot=6, 'wdLineStyleDashDotStroked=20
'wdLineStyleDashLargeGap=4, 'wdLineStyleDashSmallGap=3
'wdLineStyleDot=2, 'wdLineStyleDouble=7
'wdLineStyleDoubleWavy=19, 'wdLineStyleEmboss3D=21
'wdLineStyleEngrave3D=22, 'wdLineStyleNone=0
'wdLineStyleSingle=1, 'wdLineStyleSingleWavy=18
'wdLineStyleThickThinLargeGap=16, 'wdLineStyleThickThinMedGap=13
'wdLineStyleThickThinSmallGap=10, 'wdLineStyleThinThickLargeGap=15
''wdLineStyleThinThickMedGap=12, 'wdLineStyleThinThickSmallGap=9
'wdLineStyleThinThickThinLargeGap=17, 'wdLineStyleThinThickThinMedGap=14
'wdLineStyleThinThickThinSmallGap=11,'ls=wdLineStyleSingle
With Selection.ParagraphFormat
If l Then
With .Borders(wdBorderLeft)
.LineStyle = ls
.LineWidth = lw
.Color = wdBlue
End With
End If
If r Then
With .Borders(wdBorderRight)
.LineStyle = ls
.LineWidth = lw
.Color = wdBlue
End With
End If
If t Then
With .Borders(wdBorderTop)
.LineStyle = ls
.LineWidth = lw
.Color = wdBlue
End With
End If
If b Then
With .Borders(wdBorderBottom)
.LineStyle = ls
.LineWidth = lw
.Color = wdBlue
End With
End If
With .Borders
.DistanceFromTop = 1
.DistanceFromLeft = 4
.DistanceFromBottom = 1
.DistanceFromRight = 4
.Shadow = ts
End With
End With

End Sub

'//-----------------------------------------------------------------
'// Création d'un tableau
'//-----------------------------------------------------------------
Sub CreateTable(rows As Integer, cols As Integer)
Call ActiveDocument.Tables.Add(Selection.Range,rows,cols)
End Sub

Sub InsertRowsBelow(n As Integer)
Call Selection.InsertRowsBelow(n)
End Sub

Sub InsertRowsAbove(n As Integer)
Call Selection.InsertRowsAbove(n)
End Sub

Sub SelectRow
Selection.SelectRow
End Sub

Sub SelectColumn
Selection.SelectColumn
End Sub

Sub RowDelete
Selection.Rows.Delete
End Sub

Sub SelectTable(n As Integer)
Selection.Tables(n).Select
End Sub

'//-----------------------------------------------------------------
'// Largeur des d'une colonne d'un tableau
'//-----------------------------------------------------------------
Sub SetTableColumnWidth(t As Integer, c As Integer, w As Single)
Dim table As Variant
Dim column As Variant
Set table=ActiveDocument.Tables(t)
Set column = table.Columns(c)
column.PreferredWidthType = 3
column.Width = WApp.CentimetersToPoints(w)
End Sub

'//-----------------------------------------------------------------
'// Hauteur d'une ligne d'un tableau
'//-----------------------------------------------------------------
Sub SetTableColumnHeight(t As Integer, r As Integer, h As Single)
'wdRowHeightAtLeast=1
'wdRowHeightAuto=0
'wdRowHeightExactly=2
Dim table As Variant
Dim row As Variant
Set table=ActiveDocument.Tables(t)
Set row = table.Rows(r)
Row.HeightRule = 2
Row.Height = WApp.CentimetersToPoints(h)
End Sub

'//-----------------------------------------------------------------
'// Lire le contenu d'une cellule d'un tableau
'//-----------------------------------------------------------------
Function GetTableCell(t As Integer, row As Long, col As Long) As Variant
Set GetTableCell=ActiveDocument.Tables(t).Cell(row,col)
End Function

'/////////////////////////////////////////
'// u = inité de déplacement
'// n = nombre de fois
'// e = extension de la sélection
'//////////////////////////////////////////

'/////////////////////////////////////////
'// Unités de déplacement
'// wdLine
'// wdParagraph
'// wdWindow
'// wdScreen
'// wdCell
'// wdSentence
'// wdSection
'// wdStory
'/////////////////////////////////////////

'//----------------------------------------------------------------
'// Déplacement à droite
'//-----------------------------------------------------------------
Sub MoveRight(u As Integer, n As Integer, e As Integer)
Call Selection.MoveRight(u,n,e)
End Sub

'//----------------------------------------------------------------
'// Homekey
'//-----------------------------------------------------------------
Sub HomeKey(u As Integer,e As Integer)
Call Selection.HomeKey(u)
End Sub

'//----------------------------------------------------------------
'// EndKey
'//-----------------------------------------------------------------
Sub EndKey(u As Integer,e As Integer)
Call Selection.EndKey(u,e)
End Sub

'//--------------------------------------------------------------------
'// Déplacement à gauche
'//-------------------------------------------------------------------
Sub MoveLeft(u As Integer,n As Integer,e As Integer)
Call Selection.MoveLeft(u,n,e)
End Sub

'//--------------------------------------------------------------------
'// Déplacement vers la fin
'//-------------------------------------------------------------------
Sub MoveEnd(u As Integer,n As Integer)
Call Selection.MoveEnd(u,n)
End Sub

'//--------------------------------------------------------------------
'// Déplacement vers le début
'//-------------------------------------------------------------------
Sub MoveStart(u As Integer,n As Integer)
Call Selection.MoveStart(u,n)
End Sub

'//--------------------------------------------------------------------
'// Déplacement vers le bas
'//-------------------------------------------------------------------
Sub MoveDown(u As Integer,n As Integer,e As Integer)
Call Selection.MoveDown(u, n,e)
End Sub

'//--------------------------------------------------------------------
'// Déplacement vers le haut
'//-------------------------------------------------------------------
Sub MoveUp(u As Integer,n As Integer,e As Integer)
Call Selection.MoveUp(u, n, e)
End Sub

'//--------------------------------------------------------------------
'// BackSpace
'//-------------------------------------------------------------------
Sub BackSpace(n As Integer,e As Integer)
Call Selection.TypeBackspace(n,e)
End Sub

'//--------------------------------------------------------------------
'// Taquet de tabulation positionné
'//-------------------------------------------------------------------
Sub TabStop(p As Single)
Call Selection.ParagraphFormat.TabStops.Add(WApp.CentimetersToPoints(p))
End Sub

'//--------------------------------------------------------------------
'// Taquet de tabulation effacé
'//-------------------------------------------------------------------
Sub TabStopClear(p As Single)
Call Selection.ParagraphFormat.TabStops(WApp.CentimetersToPoints(p)).Clear
End Sub

'//------------------------------------------------------------------------
'// Ajouter un signet
'//------------------------------------------------------------------------
Public Sub AddBookmark ( bookmark As String)
Call Document.Bookmarks.Add (bookmark)
End Sub

'//---------------------------------------------------------------------------
'// Remplacer le texte d'un signet
'//---------------------------------------------------------------------------
Public Sub UpdateTextBookmark (bookmark As String, value As String)
ActiveDocument.Bookmarks(bookmark).Range.Text=value
End Sub

'//---------------------------------------------------------------------------
'// Remplacer le texte d'un signet juste après
'//---------------------------------------------------------------------------
Public Sub InsertAfterBookmark (bookmark As String, value As String)
ActiveDocument.Bookmarks(bookmark).Range.InsertAfter(value)
End Sub

'//---------------------------------------------------------------------------
'// Supprimer un signet
'//---------------------------------------------------------------------------
Public Sub DeleteBookmark (bookmark As String)
ActiveDocument.Bookmarks(bookmark).Delete
End Sub

'//-----------------------------------------------------------------------
'// Selectionner un signet
'//------------------------------------------------------------------------
Sub GotoBookmark(bookmark As String)
ActiveDocument.Bookmarks(bookmark).Select
End Sub

'//-----------------------------------------------------------------------
'// Nombre de signets
'//------------------------------------------------------------------------
Function getBoorkmarks() As Integer
getBoorkmarks=ActiveDocument.Bookmarks.Count
End Function

'//-----------------------------------------------------------------------
'// Tester existance d'un signet
'//------------------------------------------------------------------------
Function ExistBookmark(bookmark As String) As Integer
ExistBookmark=ActiveDocument.Bookmarks.Exists(bookmark)
End Function

'//-----------------------------------------------------------------------
'// Affiche les signets
'//------------------------------------------------------------------------
Sub ShowBookmarks(toggle As Integer)
ActiveWindow.View.ShowBookmarks = toggle
End Sub

'//---------------------------------------------------------------------------
'// Mise à jour d'un champ
'//---------------------------------------------------------------------------
Public Sub UpdateField (field As String, value As String)
Document.FormFields(field).result = value
End Sub

'//--------------------------------------------------------------------
'// Enregistrement du document
'//-------------------------------------------------------------------
Sub saveAs(fn As String)
Activedocument.SaveAs fn
End Sub

Sub Save
ActiveDocument.Save
End Sub

'//----------------------------------------
'// Ferme le document
'//----------------------------------------
Sub CloseDocument(toogle)
Call Document.Close(toogle)
End Sub

'//--------------------------------------------------------------------
'// Appeler une macro
'//--------------------------------------------------------------------
Sub RunMacro(macro As String)
WApp.Run("[" & macro & "]")
End Sub

'//----------------------------------------
'// Entête de page
'//----------------------------------------
Sub SetHeader(t1 As String, t2 As String, t3 As String)
Dim Paragraph As Variant
Dim header As Variant
Dim p As Long
Set Section=document.Sections(1)
Set header = section.Headers(1)
Set Paragraph = header.Range
Call Paragraph.InsertBefore(t1 & Chr$(9) & t2 & Chr$(9) & t3)
Call showHeader
End Sub

'//-------------------------------------
'// Bas de page
'//------------------------------------
Sub SetFooter(t1 As String, t2 As String, t3 As String)
Dim Paragraph As Variant
Dim footer As Variant
Dim p As Long
Set Section=document.Sections(1)
Set footer = section.Footers(1)
Set Paragraph = footer.Range
Call Paragraph.InsertBefore(t1 & Chr$(9) & t2 & Chr$(9) & t3 & Chr$(9))
Set Paragraph = footer.Range
p = Paragraph.End
Call Paragraph.SetRange(p, p)
Call Paragraph.Fields.Add(Paragraph, 33)
Set Paragraph = footer.Range
p = Paragraph.End
Call Paragraph.SetRange(p, p)
Call Paragraph.InsertBefore("/")
Set Paragraph = footer.Range
p = Paragraph.End
Call Paragraph.SetRange(p, p)
Call Paragraph.Fields.Add(Paragraph, 26)
Call showHeader
End Sub

Private Sub showHeader
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

Private Sub initPanes
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
ActiveWindow.Panes(2).Close
End If

If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
ActivePane.View.Type = wdOutlineView Then
ActiveWindow.ActivePane.View.Type = wdPrintView
End If
End Sub

'//--------------------------------------------------------------------
'// Fermeture d'une session MS Word
'//--------------------------------------------------------------------
Sub QuitSession
On Error Goto CreateSession
Set WApp = GetObject("", "Word.Application")
ExistSessionOK:
WApp.Quit
Print "Session MS Word terminée"
Exit Sub
CreateSession:
Err = 0
WApp = CreateObject("Word.Application")
If WApp Is Nothing Then
Error 9999,"Impossibile d'initialiser la session MS Word"
Resume EndCloseSession
End If
Resume ExistSessionOK
EndClosesession:
End Sub
End Class

Public Class ExportToWord As WordSession
Sub new (template As String)
Call AddNewDocument(template)
End Sub
End Class
[/syntax]
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar oguruma » 19 Oct 2005 à 13:37

il y a aussi de nouvelles constantes

Const wd100Words=-4
Const wd10Percent=-6
Const wd10Sentences=-2
Const wd20Sentences=-3
Const wd24HourClock=21
Const wd25Percent=-7
Const wd500Words=-5
Const wd50Percent=-8
Const wd75Percent=-9
Const wdActiveEndAdjustedPageNumber=1
Const wdActiveEndPageNumber=3
Const wdActiveEndSectionNumber=2
Const wdAdjective=0
Const wdAdjustFirstColumn=2
Const wdAdjustNone=0
Const wdAdjustProportional=1
Const wdAdjustSameWidth=3
Const wdAdverb=2
Const wdAfrikaans=1078
Const wdAlertsAll=-1
Const wdAlertsMessageBox=-2
Const wdAlertsNone=0
Const wdAlignPageNumberCenter=1
Const wdAlignPageNumberInside=3
Const wdAlignPageNumberLeft=0
Const wdAlignPageNumberOutside=4
Const wdAlignPageNumberRight=2
Const wdAlignParagraphCenter=1
Const wdAlignParagraphDistribute=4
Const wdAlignParagraphJustify=3
Const wdAlignParagraphLeft=0
Const wdAlignParagraphRight=2
Const wdAlignRowCenter=1
Const wdAlignRowLeft=0
Const wdAlignRowRight=2
Const wdAlignTabBar=4
Const wdAlignTabCenter=1
Const wdAlignTabDecimal=3
Const wdAlignTabLeft=0
Const wdAlignTabList=6
Const wdAlignTabRight=2
Const wdAlignVerticalBottom=3
Const wdAlignVerticalCenter=1
Const wdAlignVerticalJustify=2
Const wdAlignVerticalTop=0
Const wdAnagram=2
Const wdArtApples=1
Const wdArtArchedScallops=97
Const wdArtBabyPacifier=70
Const wdArtBabyRattle=71
Const wdArtBalloons3Colors=11
Const wdArtBalloonsHotAir=12
Const wdArtBasicBlackDashes=155
Const wdArtBasicBlackDots=156
Const wdArtBasicBlackSquares=154
Const wdArtBasicThinLines=151
Const wdArtBasicWhiteDashes=152
Const wdArtBasicWhiteDots=147
Const wdArtBasicWhiteSquares=153
Const wdArtBasicWideInline=150
Const wdArtBasicWideMidline=148
Const wdArtBasicWideOutline=149
Const wdArtBats=37
Const wdArtBirds=102
Const wdArtBirdsFlight=35
Const wdArtCabins=72
Const wdArtCakeSlice=3
Const wdArtCandyCorn=4
Const wdArtCelticKnotwork=99
Const wdArtCertificateBanner=158
Const wdArtChainLink=128
Const wdArtChampagneBottle=6
Const wdArtCheckedBarBlack=145
Const wdArtCheckedBarColor=61
Const wdArtCheckered=144
Const wdArtChristmasTree=8
Const wdArtCirclesLines=91
Const wdArtCirclesRectangles=140
Const wdArtClassicalWave=56
Const wdArtClocks=27
Const wdArtCompass=54
Const wdArtConfetti=31
Const wdArtConfettiGrays=115
Const wdArtConfettiOutline=116
Const wdArtConfettiStreamers=14
Const wdArtConfettiWhite=117
Const wdArtCornerTriangles=141
Const wdArtCouponCutoutDashes=163
Const wdArtCouponCutoutDots=164
Const wdArtCrazyMaze=100
Const wdArtCreaturesButterfly=32
Const wdArtCreaturesFish=34
Const wdArtCreaturesInsects=142
Const wdArtCreaturesLadyBug=33
Const wdArtCrossStitch=138
Const wdArtCup=67
Const wdArtDecoArch=89
Const wdArtDecoArchColor=50
Const wdArtDecoBlocks=90
Const wdArtDiamondsGray=88
Const wdArtDoubleD=55
Const wdArtDoubleDiamonds=127
Const wdArtEarth1=22
Const wdArtEarth2=21
Const wdArtEclipsingSquares1=101
Const wdArtEclipsingSquares2=86
Const wdArtEggsBlack=66
Const wdArtFans=51
Const wdArtFilm=52
Const wdArtFirecrackers=28
Const wdArtFlowersBlockPrint=49
Const wdArtFlowersDaisies=48
Const wdArtFlowersModern1=45
Const wdArtFlowersModern2=44
Const wdArtFlowersPansy=43
Const wdArtFlowersRedRose=39
Const wdArtFlowersRoses=38
Const wdArtFlowersTeacup=103
Const wdArtFlowersTiny=42
Const wdArtGems=139
Const wdArtGingerbreadMan=69
Const wdArtGradient=122
Const wdArtHandmade1=159
Const wdArtHandmade2=160
Const wdArtHeartBalloon=16
Const wdArtHeartGray=68
Const wdArtHearts=15
Const wdArtHeebieJeebies=120
Const wdArtHolly=41
Const wdArtHouseFunky=73
Const wdArtHypnotic=87
Const wdArtIceCreamCones=5
Const wdArtLightBulb=121
Const wdArtLightning1=53
Const wdArtLightning2=119
Const wdArtMapPins=30
Const wdArtMapleLeaf=81
Const wdArtMapleMuffins=2
Const wdArtMarquee=146
Const wdArtMarqueeToothed=131
Const wdArtMoons=125
Const wdArtMosaic=118
Const wdArtMusicNotes=79
Const wdArtNorthwest=104
Const wdArtOvals=126
Const wdArtPackages=26
Const wdArtPalmsBlack=80
Const wdArtPalmsColor=10
Const wdArtPaperClips=82
Const wdArtPapyrus=92
Const wdArtPartyFavor=13
Const wdArtPartyGlass=7
Const wdArtPencils=25
Const wdArtPeople=84
Const wdArtPeopleHats=23
Const wdArtPeopleWaving=85
Const wdArtPoinsettias=40
Const wdArtPostageStamp=135
Const wdArtPumpkin1=65
Const wdArtPushPinNote1=63
Const wdArtPushPinNote2=64
Const wdArtPyramids=113
Const wdArtPyramidsAbove=114
Const wdArtQuadrants=60
Const wdArtRings=29
Const wdArtSafari=98
Const wdArtSawtooth=133
Const wdArtSawtoothGray=134
Const wdArtScaredCat=36
Const wdArtSeattle=78
Const wdArtShadowedSquares=57
Const wdArtSharksTeeth=132
Const wdArtShorebirdTracks=83
Const wdArtSkyrocket=77
Const wdArtSnowflakeFancy=76
Const wdArtSnowflakes=75
Const wdArtSombrero=24
Const wdArtSouthwest=105
Const wdArtStars3D=17
Const wdArtStars=19
Const wdArtStarsBlack=74
Const wdArtStarsShadowed=18
Const wdArtStarsTop=157
Const wdArtSun=20
Const wdArtSwirligig=62
Const wdArtTornPaper=161
Const wdArtTornPaperBlack=162
Const wdArtTrees=9
Const wdArtTriangleParty=123
Const wdArtTriangles=129
Const wdArtTribal1=130
Const wdArtTribal2=109
Const wdArtTribal3=108
Const wdArtTribal4=107
Const wdArtTribal5=110
Const wdArtTribal6=106
Const wdArtTwistedLines1=58
Const wdArtTwistedLines2=124
Const wdArtVine=47
Const wdArtWaveline=59
Const wdArtWeavingAngles=96
Const wdArtWeavingBraid=94
Const wdArtWeavingRibbon=95
Const wdArtWeavingStrips=136
Const wdArtWhiteFlowers=46
Const wdArtWoodwork=93
Const wdArtXIllusions=111
Const wdArtZanyTriangles=112
Const wdArtZigZag=137
Const wdArtZigZagStitch=143
Const wdAtEndOfRowMarker=31
Const wdAuto=0
Const wdAutoPosition=0
Const wdAutoVersionOff=0
Const wdAutoVersionOnClose=1
Const wdBack=1
Const wdBackward=-1073741823
Const wdBlue=2
Const wdBorderBottom=-3
Const wdBorderDiagonalDown=-7
Const wdBorderDiagonalUp=-8
Const wdBorderDistanceFromPageEdge=1
Const wdBorderDistanceFromText=0
Const wdBorderHorizontal=-5
Const wdBorderLeft=-2
Const wdBorderRight=-4
Const wdBorderTop=-1
Const wdBorderVertical=-6
Const wdBrightGreen=4
Const wdCapsLock=21
Const wdCell=12
Const wdCellAlignVerticalBottom=3
Const wdCellAlignVerticalCenter=1
Const wdCellAlignVerticalTop=0
Const wdCenterClockwise=7
Const wdCenterLandscape=4
Const wdCenterPortrait=1
Const wdCharacter=1
Const wdCharacterFormatting=13
Const wdColumn=9
Const wdCreatorCode=1297307460
Const wdDarkBlue=9
Const wdDarkRed=13
Const wdDarkYellow=14
Const wdDeleteCellsEntireColumn=3
Const wdDeleteCellsEntireRow=2
Const wdDeleteCellsShiftLeft=0
Const wdDeleteCellsShiftUp=1
Const wdDoNotSaveChanges=0
Const wdEndOfRangeColumnNumber=17
Const wdEndOfRangeRowNumber=14
Const wdExtend=1
Const wdFieldAddin=81
Const wdFieldAdvance=84
Const wdFieldAsk=38
Const wdFieldAuthor=17
Const wdFieldAutoNum=54
Const wdFieldAutoNumLegal=53
Const wdFieldAutoNumOutline=52
Const wdFieldAutoText=79
Const wdFieldAutoTextList=89
Const wdFieldBarCode=63
Const wdFieldComments=19
Const wdFieldCompare=80
Const wdFieldCreateDate=21
Const wdFieldDDE=45
Const wdFieldDDEAuto=46
Const wdFieldData=40
Const wdFieldDatabase=78
Const wdFieldDate=31
Const wdFieldDocProperty=85
Const wdFieldDocVariable=64
Const wdFieldEditTime=25
Const wdFieldEmbed=58
Const wdFieldEmpty=-1
Const wdFieldExpression=34
Const wdFieldFileName=29
Const wdFieldFileSize=69
Const wdFieldFillIn=39
Const wdFieldFootnoteRef=5
Const wdFieldFormCheckBox=71
Const wdFieldFormDropDown=83
Const wdFieldFormTextInput=70
Const wdFieldFormula=49
Const wdFieldGlossary=47
Const wdFieldGoToButton=50
Const wdFieldHTMLActiveX=91
Const wdFieldHyperlink=88
Const wdFieldIf=7
Const wdFieldImport=55
Const wdFieldInclude=36
Const wdFieldIncludePicture=67
Const wdFieldIncludeText=68
Const wdFieldIndex=8
Const wdFieldIndexEntry=4
Const wdFieldInfo=14
Const wdFieldKeyWord=18
Const wdFieldKindCold=3
Const wdFieldKindHot=1
Const wdFieldKindNone=0
Const wdFieldKindWarm=2
Const wdFieldLastSavedBy=20
Const wdFieldLink=56
Const wdFieldListNum=90
Const wdFieldMacroButton=51
Const wdFieldMergeField=59
Const wdFieldMergeRec=44
Const wdFieldMergeSeq=75
Const wdFieldNext=41
Const wdFieldNextIf=42
Const wdFieldNoteRef=72
Const wdFieldNumChars=28
Const wdFieldNumPages=26
Const wdFieldNumWords=27
Const wdFieldOCX=87
Const wdFieldPage=33
Const wdFieldPageRef=37
Const wdFieldPrint=48
Const wdFieldPrintDate=23
Const wdFieldPrivate=77
Const wdFieldQuote=35
Const wdFieldRef=3
Const wdFieldRefDoc=11
Const wdFieldRevisionNum=24
Const wdFieldSaveDate=22
Const wdFieldSection=65
Const wdFieldSectionPages=66
Const wdFieldSequence=12
Const wdFieldSet=6
Const wdFieldShadingAlways=1
Const wdFieldShadingNever=0
Const wdFieldShadingWhenSelected=2
Const wdFieldSkipIf=43
Const wdFieldStyleRef=10
Const wdFieldSubject=16
Const wdFieldSubscriber=82
Const wdFieldSymbol=57
Const wdFieldTOA=73
Const wdFieldTOAEntry=74
Const wdFieldTOC=13
Const wdFieldTOCEntry=9
Const wdFieldTemplate=30
Const wdFieldTime=32
Const wdFieldTitle=15
Const wdFieldUserAddress=62
Const wdFieldUserInitials=61
Const wdFieldUserName=60
Const wdFindAsk=2
Const wdFindContinue=1
Const wdFindStop=0
Const wdFirst=1
Const wdFirstCharacterColumnNumber=9
Const wdFirstCharacterLineNumber=10
Const wdFloatOverText=1
Const wdFontBiasDefault=0
Const wdFontBiasDontCare=255
Const wdFontBiasFareast=1
Const wdForward=1073741823
Const wdFrameIsSelected=11
Const wdFullBlock=0
Const wdGenderFemale=0
Const wdGenderMale=1
Const wdGenderNeutral=2
Const wdGenderUnknown=3
Const wdGoToAbsolute=1
Const wdGoToBookmark=-1
Const wdGoToComment=6
Const wdGoToEndnote=5
Const wdGoToEquation=10
Const wdGoToField=7
Const wdGoToFirst=1
Const wdGoToFootnote=4
Const wdGoToGrammaticalError=14
Const wdGoToGraphic=8
Const wdGoToHeading=11
Const wdGoToLast=-1
Const wdGoToLine=3
Const wdGoToNext=2
Const wdGoToObject=9
Const wdGoToPage=1
Const wdGoToPercent=12
Const wdGoToPrevious=3
Const wdGoToProofreadingError=15
Const wdGoToRelative=2
Const wdGoToSection=0
Const wdGoToSpellingError=13
Const wdGoToTable=2
Const wdGrammar=1
Const wdGrammaticalError=1
Const wdGray25=16
Const wdGray50=15
Const wdGreen=11
Const wdHangulHanjaConversion=8
Const wdHangulHanjaConversionCustom=9
Const wdHeaderFooterEvenPages=3
Const wdHeaderFooterFirstPage=2
Const wdHeaderFooterPrimary=1
Const wdHeaderFooterType=33
Const wdHorizontalPositionRelativeToPage=5
Const wdHyphenation=3
Const wdIcons=1
Const wdInClipboard=38
Const wdInCommentPane=26
Const wdInEndnote=36
Const wdInFootnote=35
Const wdInFootnoteEndnotePane=25
Const wdInHeaderFooter=28
Const wdInLine=0
Const wdInMasterDocument=34
Const wdInWordMail=37
Const wdInlineShapeEmbeddedOLEObject=1
Const wdInlineShapeLinkedOLEObject=2
Const wdInlineShapeLinkedPicture=4
Const wdInlineShapeOLEControlObject=5
Const wdInlineShapePicture=3
Const wdInsertCellsEntireColumn=3
Const wdInsertCellsEntireRow=2
Const wdInsertCellsShiftDown=1
Const wdInsertCellsShiftRight=0
Const wdItem=16
Const wdKeyBackSingleQuote=192
Const wdKeyBackSlash=220
Const wdKeyCloseSquareBrace=221
Const wdKeyComma=188
Const wdKeyDelete=46
Const wdKeyEnd=35
Const wdKeyEquals=187
Const wdKeyEsc=27
Const wdKeyF10=121
Const wdKeyF11=122
Const wdKeyF12=123
Const wdKeyF13=124
Const wdKeyF14=125
Const wdKeyF15=126
Const wdKeyF16=127
Const wdKeyF1=112
Const wdKeyF2=113
Const wdKeyF3=114
Const wdKeyF4=115
Const wdKeyF5=116
Const wdKeyF6=117
Const wdKeyF7=118
Const wdKeyF8=119
Const wdKeyF9=120
Const wdKeyHome=36
Const wdKeyHyphen=189
Const wdKeyInsert=45
Const wdKeyNumeric0=96
Const wdKeyNumeric1=97
Const wdKeyNumeric2=98
Const wdKeyNumeric3=99
Const wdKeyNumeric4=100
Const wdKeyNumeric5=101
Const wdKeyNumeric6=102
Const wdKeyNumeric7=103
Const wdKeyNumeric8=104
Const wdKeyNumeric9=105
Const wdKeyNumericAdd=107
Const wdKeyNumericDecimal=110
Const wdKeyNumericDivide=111
Const wdKeyNumericMultiply=106
Const wdKeyNumericSubtract=109
Const wdKeyOpenSquareBrace=219
Const wdKeyPageDown=34
Const wdKeyPageUp=33
Const wdKeyPause=19
Const wdKeyPeriod=190
Const wdKeyScrollLock=145
Const wdKeySemiColon=186
Const wdKeySingleQuote=222
Const wdKeySlash=191
Const wdKeySpacebar=32
Const wdLeftClockwise=6
Const wdLeftLandscape=3
Const wdLeftPortrait=0
Const wdLetterBottom=1
Const wdLetterLeft=2
Const wdLetterRight=3
Const wdLetterTop=0
Const wdLine=5
Const wdLineBreak=6
Const wdLineSpace1pt5=1
Const wdLineSpaceAtLeast=3
Const wdLineSpaceDouble=2
Const wdLineSpaceExactly=4
Const wdLineSpaceMultiple=5
Const wdLineSpaceSingle=0
Const wdLineStyleDashDot=5
Const wdLineStyleDashDotDot=6
Const wdLineStyleDashDotStroked=20
Const wdLineStyleDashLargeGap=4
Const wdLineStyleDashSmallGap=3
Const wdLineStyleDot=2
Const wdLineStyleDouble=7
Const wdLineStyleDoubleWavy=19
Const wdLineStyleEmboss3D=21
Const wdLineStyleEngrave3D=22
Const wdLineStyleNone=0
Const wdLineStyleSingle=1
Const wdLineStyleSingleWavy=18
Const wdLineStyleThickThinLargeGap=16
Const wdLineStyleThickThinMedGap=13
Const wdLineStyleThickThinSmallGap=10
Const wdLineStyleThinThickLargeGap=15
Const wdLineStyleThinThickMedGap=12
Const wdLineStyleThinThickSmallGap=9
Const wdLineStyleThinThickThinLargeGap=17
Const wdLineStyleThinThickThinMedGap=14
Const wdLineStyleThinThickThinSmallGap=11
Const wdLineStyleTriple=8
Const wdLineWidth025pt=2
Const wdLineWidth050pt=4
Const wdLineWidth075pt=6
Const wdLineWidth100pt=8
Const wdLineWidth150pt=12
Const wdLineWidth225pt=18
Const wdLineWidth300pt=24
Const wdLineWidth450pt=36
Const wdLineWidth600pt=48
Const wdLineWrapLikeWord6=32
Const wdMasterView=5
Const wdMatchAnyCharacter=65599
Const wdMatchAnyDigit=65567
Const wdMatchAnyLetter=65583
Const wdMatchCaretCharacter=11
Const wdMatchColumnBreak=14
Const wdMatchCommentMark=5
Const wdMatchEmDash=8212
Const wdMatchEnDash=8211
Const wdMatchEndnoteMark=65555
Const wdMatchField=19
Const wdMatchFootnoteMark=65554
Const wdMatchGraphic=1
Const wdMatchManualLineBreak=65551
Const wdMatchManualPageBreak=65564
Const wdMatchNonbreakingHyphen=30
Const wdMatchNonbreakingSpace=160
Const wdMatchOptionalHyphen=31
Const wdMatchParagraphMark=65551
Const wdMatchSectionBreak=65580
Const wdMatchTabCharacter=9
Const wdMatchWhiteSpace=65655
Const wdMaximumNumberOfColumns=18
Const wdMaximumNumberOfRows=15
Const wdModifiedBlock=1
Const wdMove=0
Const wdNormalView=1
Const wdNumLock=22
Const wdNumberOfPagesInDocument=4
Const wdOLEControl=2
Const wdOLEEmbed=1
Const wdOLELink=0
Const wdOLEVerbDiscardUndoState=-6
Const wdOLEVerbHide=-3
Const wdOLEVerbInPlaceActivate=-5
Const wdOLEVerbOpen=-2
Const wdOLEVerbPrimary=0
Const wdOLEVerbShow=-1
Const wdOLEVerbUIActivate=-4
Const wdOrganizerObjectAutoText=1
Const wdOrganizerObjectCommandBars=2
Const wdOrganizerObjectProjectItems=3
Const wdOrganizerObjectStyles=0
Const wdOrientLandscape=1
Const wdOrientPortrait=0
Const wdOutlineLevel1=1
Const wdOutlineLevel2=2
Const wdOutlineLevel3=3
Const wdOutlineLevel4=4
Const wdOutlineLevel5=5
Const wdOutlineLevel6=6
Const wdOutlineLevel7=7
Const wdOutlineLevel8=8
Const wdOutlineLevel9=9
Const wdOutlineLevelBodyText=10
Const wdOutlineNumberGallery=3
Const wdOutlineView=2
Const wdOverType=23
Const wdPageBreak=7
Const wdPageFitBestFit=2
Const wdPageFitFullPage=1
Const wdPageFitNone=0
Const wdPageNumber=7
Const wdPageNumberStyleArabic=0
Const wdPageNumberStyleArabicFullWidth=14
Const wdPageNumberStyleHanjaRead=41
Const wdPageNumberStyleHanjaReadDigit=42
Const wdPageNumberStyleKanji=10
Const wdPageNumberStyleKanjiDigit=11
Const wdPageNumberStyleKanjiTraditional=16
Const wdPageNumberStyleLowercaseLetter=4
Const wdPageNumberStyleLowercaseRoman=2
Const wdPageNumberStyleNumberInCircle=18
Const wdPageNumberStyleSimpChinNum1=37
Const wdPageNumberStyleSimpChinNum2=38
Const wdPageNumberStyleTradChinNum1=33
Const wdPageNumberStyleTradChinNum2=34
Const wdPageNumberStyleUppercaseLetter=3
Const wdPageNumberStyleUppercaseRoman=1
Const wdPageView=3
Const wdPaneComments=15
Const wdPaneCurrentPageFooter=17
Const wdPaneCurrentPageHeader=16
Const wdPaneEndnoteContinuationNotice=12
Const wdPaneEndnoteContinuationSeparator=13
Const wdPaneEndnoteSeparator=14
Const wdPaneEndnotes=8
Const wdPaneEvenPagesFooter=6
Const wdPaneEvenPagesHeader=3
Const wdPaneFirstPageFooter=5
Const wdPaneFirstPageHeader=2
Const wdPaneFootnoteContinuationNotice=9
Const wdPaneFootnoteContinuationSeparator=10
Const wdPaneFootnoteSeparator=11
Const wdPaneFootnotes=7
Const wdPaneNone=0
Const wdParagraph=4
Const wdParagraphFormatting=14
Const wdPasteBitmap=4
Const wdPasteDeviceIndependentBitmap=5
Const wdPasteEnhancedMetafile=9
Const wdPasteHyperlink=7
Const wdPasteMetafilePicture=3
Const wdPasteOLEObject=0
Const wdPasteRTF=1
Const wdPasteShape=8
Const wdPasteText=2
Const wdPink=5
Const wdPrintAllDocument=0
Const wdPrintAllPages=0
Const wdPrintAutoTextEntries=4
Const wdPrintComments=2
Const wdPrintCurrentPage=2
Const wdPrintDocumentContent=0
Const wdPrintEnvelope=6
Const wdPrintEvenPagesOnly=2
Const wdPrintFromTo=3
Const wdPrintKeyAssignments=5
Const wdPrintOddPagesOnly=1
Const wdPrintProperties=1
Const wdPrintRangeOfPages=4
Const wdPrintSelection=1
Const wdPrintStyles=3
Const wdRed=6
Const wdReferenceOfType=32
Const wdReplaceAll=2
Const wdReplaceNone=0
Const wdReplaceOne=1
Const wdRevisionMarking=24
Const wdRightClockwise=8
Const wdRightLandscape=5
Const wdRightPortrait=2
Const wdRow=10
Const wdRowHeightAtLeast=1
Const wdRowHeightAuto=0
Const wdRowHeightExactly=2
Const wdSalutationBusiness=2
Const wdSalutationFormal=1
Const wdSalutationInformal=0
Const wdSalutationOther=3
Const wdScreen=7
Const wdSection=8
Const wdSectionBreakNextPage=2
Const wdSeekCurrentPageFooter=10
Const wdSeekCurrentPageHeader=9
Const wdSeekEndnotes=8
Const wdSeekEvenPagesFooter=6
Const wdSeekEvenPagesHeader=3
Const wdSeekFirstPageFooter=5
Const wdSeekFirstPageHeader=2
Const wdSeekFootnotes=7
Const wdSeekMainDocument=0
Const wdSeekPrimaryFooter=4
Const wdSeekPrimaryHeader=1
Const wdSelActive=8
Const wdSelAtEOL=2
Const wdSelOvertype=4
Const wdSelReplace=16
Const wdSelStartActive=1
Const wdSelectionMode=20
Const wdSemiBlock=2
Const wdSentence=3
Const wdSpelling=0
Const wdSpellingCapitalization=2
Const wdSpellingComplete=4
Const wdSpellingCorrect=0
Const wdSpellingCustom=5
Const wdSpellingError=0
Const wdSpellingLegal=6
Const wdSpellingMedical=7
Const wdSpellingNotInDictionary=1
Const wdSpellword=0
Const wdStartOfRangeColumnNumber=16
Const wdStartOfRangeRowNumber=13
Const wdStory=6
Const wdStyleTypeCharacter=2
Const wdStyleTypeParagraph=1
Const wdTable=15
Const wdTeal=10
Const wdTextOrientationDownward=3
Const wdTextOrientationHorizontal=0
Const wdTextOrientationUpward=2
Const wdTexture12Pt5Percent=125
Const wdTexture15Percent=150
Const wdTexture17Pt5Percent=175
Const wdTexture20Percent=200
Const wdTexture22Pt5Percent=225
Const wdTexture25Percent=250
Const wdTexture27Pt5Percent=275
Const wdTexture2Pt5Percent=25
Const wdTexture30Percent=300
Const wdTexture32Pt5Percent=325
Const wdTexture35Percent=350
Const wdTexture37Pt5Percent=375
Const wdTexture40Percent=400
Const wdTexture42Pt5Percent=425
Const wdTexture45Percent=450
Const wdTexture47Pt5Percent=475
Const wdTexture50Percent=500
Const wdTexture52Pt5Percent=525
Const wdTexture55Percent=550
Const wdTexture57Pt5Percent=575
Const wdTexture5Percent=50
Const wdTexture60Percent=600
Const wdTexture62Pt5Percent=625
Const wdTexture65Percent=650
Const wdTexture67Pt5Percent=675
Const wdTexture70Percent=700
Const wdTexture72Pt5Percent=725
Const wdTexture75Percent=750
Const wdTexture77Pt5Percent=775
Const wdTexture7Pt5Percent=75
Const wdTexture80Percent=800
Const wdTexture82Pt5Percent=825
Const wdTexture85Percent=850
Const wdTexture87Pt5Percent=875
Const wdTexture90Percent=900
Const wdTexture92Pt5Percent=925
Const wdTexture95Percent=950
Const wdTexture97Pt5Percent=975
Const wdTextureCross=-11
Const wdTextureDarkCross=-5
Const wdTextureDarkDiagonalCross=-6
Const wdTextureDarkDiagonalDown=-3
Const wdTextureDarkDiagonalUp=-4
Const wdTextureDarkHorizontal=-1
Const wdTextureDarkVertical=-2
Const wdTextureDiagonalCross=-12
Const wdTextureDiagonalDown=-9
Const wdTextureDiagonalUp=-10
Const wdTextureHorizontal=-7
Const wdTextureNone=0
Const wdTextureSolid=1000
Const wdTextureVertical=-8
Const wdThesaurus=2
Const wdTiled=0
Const wdToggle=9999998
Const wdTurquoise=3
Const wdUn=9999999
Const wdUnderlineDash=7
Const wdUnderlineDotDash=9
Const wdUnderlineDotDotDash=10
Const wdUnderlineDotted=4
Const wdUnderlineDouble=3
Const wdUnderlineNone=0
Const wdUnderlineSingle=1
Const wdUnderlineThick=6
Const wdUnderlineWavy=11
Const wdUnderlineWords=2
Const wdVerticalPositionRelativeToPage=6
Const wdWhite=8
Const wdWildcard=1
Const wdWindow=11
Const wdWindowStateMaximize=1
Const wdWindowStateMinimize=2
Const wdWindowStateNormal=0
Const wdWithInTable=12
Const wdWord=2
Const wdWrapBoth=0
Const wdWrapLargest=3
Const wdWrapLeft=1
Const wdWrapNone=3
Const wdWrapRight=2
Const wdWrapSquare=0
Const wdWrapThrough=2
Const wdWrapTight=1
Const wdWrapTopBottom=4
Const wdYellow=7
Const wdZoomPercentage=19
Const wsViolet=12
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Quelques exemples d'utilisation

Messagepar oguruma » 19 Oct 2005 à 14:08

[syntax="ls"]
Sub Initialize
Dim etw As ExportToWord
Set etw=New ExportToWord("")
Call etw.setVisible(True)
Call etw.AppendText("document 1 - ligne 1",True)
Call etw.AppendText("document 1 - ligne 2",True)

Call etw.AddNewDocument("")
Call etw.AppendText("document 2 - ligne 1",True)
Call etw.AppendText("document 2 - ligne 2",True)

Call etw.ActivateDocument(1)
Call etw.AppendText("RE : document 1 - ligne 1",True)
Call etw.AppendText("RE: document 1 - ligne 2",True)

Call etw.ActivateDocument(2)
Call etw.AppendText("RE : document 2 - ligne 1",True)
Call etw.AppendText("RE: document 2 - ligne 2",True)

Call etw.AddNewDocument("Brochure.Dot")
Call etw.AppendText("Brochure ligne 1",True)
Call etw.AppendText("Brochure ligne 2",True)

End Sub

Sub Initialize
Dim etw As ExportToWord
Dim selection As Variant
Set etw=New ExportToWord("")
Set selection=etw.GetSelection()
Call etw.SetVisible(True)
Call etw.NewLine(4)
Call etw.MoveUp(wdLine,3,False)
Call etw.Appendtext("DominoArea c'est super",False)
Call etw.BorderAll(wdLineWidth225pt,wdLineStyleDouble,False,True,False,False,False)
Call etw.MoveDown(wdLine,1,False)
End Sub

Sub Initialize
Dim etw As ExportToWord
Set etw=New ExportToWord("c:\alpha\modele01.dot")
Call etw.SHowBookmarks(True)
Call etw.setVisible(True)
Call etw.AddBookmark("SignetAjout")
Call etw.UpdateTextBookmark ("SignetAjout","texte du signet ajout")
Call etw.InsertAfterBookmark("SignetAjout","txte afet signet ajout !!")
Call etw.UpdateField ("StoreName","CDY")
Call etw.UpdateField ("Instruction","INST")
Call etw.UpdateTextBookmark ("Detail","Les détails du signet")
Call etw.InsertAfterBookmark("Detail","Insert after")
Call etw.GotoBookmark("Detail")
Call etw.DeleteBookmark("SignetAjout")
Call etw.SetHeader("Essai de mep")
End Sub

[/syntax]
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Pb avec ActiveDocument

Messagepar Aquanotes » 21 Sep 2006 à 10:41

Salut oguruma,

Je tente d'utiliser ta classe. J'ai quelques soucis avec le ActiveDocument.

Si on reprend ton code ci dessous en enregistrant doc1 et doc2 après chaque Activate :

Code : Tout sélectionner
Dim etw As ExportToWord
   Set etw=New ExportToWord("")
   Call etw.setVisible(True)
   Call etw.AppendText("document 1 - ligne 1",True)
   Call etw.AppendText("document 1 - ligne 2",True)
   
   Call etw.AddNewDocument("")
   Call etw.AppendText("document 2 - ligne 1",True)
   Call etw.AppendText("document 2 - ligne 2",True)
   
   Call etw.ActivateDocument(1)
   Call etw.AppendText("RE : document 1 - ligne 1",True)
   Call etw.AppendText("RE: document 1 - ligne 2",True)
   Call etw.saveas ("c:\doc1.doc")
   
   Call etw.ActivateDocument(2)
   Call etw.AppendText("RE : document 2 - ligne 1",True)
   Call etw.AppendText("RE: document 2 - ligne 2",True)
   Call etw.saveas ("c:\doc2.doc")


On obtient dans doc1.doc :

document 2 - ligne 1
document 2 - ligne 2


et dans doc2.doc :

document 1 - ligne 1
document 1 - ligne 2
RE : document 1 - ligne 1
RE: document 1 - ligne 2
RE : document 2 - ligne 1
RE: document 2 - ligne 2


En fait si l'on ajoute un Msgbox "save " & ActiveDocument.name dans le SaveAs de la classe on obtient :

Call etw.saveas ("c:\doc1.doc") => "Save Document2"
Call etw.saveas ("c:\doc2.doc") => "Save Document1"

De plus lors de l'appel à AddNewDocument, le document ajouté doit être le ActiveDocument, hors si l'on mets cette fois ci un Msgbox "active le document " & Document.name & " sur " & Documents.Count & " documents" dans la fonction AddNewDocument, on obtient :

Active le document Document1 sur 1 documents (ok, cas du new)
Active le document Document1 sur 2 documents (?, cas du add, je pensais avoir Document2 et non Document1)

Si tu as une explication ? car je tourne en rond :wink:
Aquanotes
Posteur habitué
Posteur habitué
 
Message(s) : 295
Inscrit(e) le : 16 Déc 2004 à 12:13
Localisation : Niort

Messagepar oguruma » 24 Sep 2006 à 14:23

ok j'ai bien pris note du pb....
je vois ce que je peux faire en fonction de mon temps ;)
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE

Messagepar Raziel » 20 Fév 2007 à 15:02

Salut Oguruma,

je me suis permis d'apporter une correction à ta classe afin de pallier le pb rencontré lors de l'appel à la fonction ActiveDocument (pb rencontré par Aquanotes)

Plusieurs Choses :
1. Il semblerai que lorsque l'on ouvre plusieurs doc, le dernier se retrouve à la position 1 et non à la position n. Dans la fonction AddNewDocument, je lance la fonction ActivateDocument avec comme paramètre 1 et non n(n étant égal à Documents.Count)

2. Le second pb provient de la gestion de la variable Windows. Après plusieurs test, je me suis aperçu que l'ordre du tableau des Windows ne correspondaient pas forcément à celui des Documents.
Afin de rendre actif la fenêtre correspondant à mon doc, je boucle sur toutes les fenêtres et je recherche celle qui porte le même nom que le doc en question


Code : Tout sélectionner
   Public Sub AddNewDocument(template As String)
      If template="" Then
         WApp.Documents.Add
      Else
         WApp.Documents.Add(template)
      End If
      Set Documents=Wapp.Documents
      Set Windows=WApp.Windows
      
'      Call ActivateDocument(Documents.Count)
      Call ActivateDocument(1)
   End Sub
Public Sub ActivateDocument(n As Integer)
      
'// A priori ça ne devrait pas se produire, mais ?       
      If n>Documents.Count Then
         Error 9999,"Impossible d'activer le document " & n
      End If
      If n=0 Then
         Error 9999,"Aucun document monté en mémoire"
      End If
      Set Document=Documents(n)
      Document.Activate
      Set ActiveDocument=WApp.ActiveDocument
      
      Set Sections=ActiveDocument.Sections
      
      Forall fenetre In windows
         If fenetre.Caption = ActiveDocument.Name Then
            Set Window = fenetre
            Set Selection=Window.Selection
         End If
      End Forall
      
      Window.Activate
      
      Set ActiveWindow=Wapp.ActiveWindow
   End Sub
Raziel

L'administration est un lieu ou les gens qui arrivent en retard croisent dans l'escalier ceux qui partent en avance. [Georges Courteline]
Avatar de l’utilisateur
Raziel
Modérateur
Modérateur
 
Message(s) : 1795
Inscrit(e) le : 21 Déc 2004 à 11:06
Localisation : Roubaix

Messagepar oguruma » 22 Fév 2007 à 09:30

;)
no soucey...
je sais que j'ai de la maintenance à faire sur certains de mes codes postés....
mais le temps manque
il faudrait une nuit de 24 h et une journée de 48 h actuellement
j'ai plein de projets de sources à déposés... certains sont dans les cartons.....
y va bien falloir que je m'y mette

merci pour en avoir assuré la maintenance....
du reste le code est open source....
Bien à vous

http://www.dominoarea.org/oguruma/

Les téléphones PORTABLES dans les TGV y en a MARRRE de ces voyageurs qui ne respectent pas les autres ! ARRET DES PORTABLES SVP - Merci

Fumeurs ! respectez les non fumeurs !!!
Fumeurs ! respectez la loi de février 2007 et les lieux publics !!! (ie. hall de gares)
Avatar de l’utilisateur
oguruma
Super V.I.P.
Super V.I.P.
 
Message(s) : 4086
Inscrit(e) le : 16 Déc 2004 à 08:50
Localisation : LILLE


Retour vers Importation/Exportation vers d'autres applications