Information générale
Catégorie:
COM/DCOM et OLE Automation
As a followup to my preceding message ...
This is the code that I used to try and get a series of tables to be indented. You will notice I have 2 different range variables defined here.
I do that so I can keep the initial Document Range open (not collapsed) until I am completely finished defining and populating each of the tables. Then, I can indent and collapse the oPartnersRange.
What actually happens here is the each succeeding table goes inside the previous table (or something like that). It looks cluttered and weird so I cannot be sure what is happening.
Any help is appreciated.
oPartnersRange = oDoc.Range()
oPartnersRange.Collapse(wdCollapseEnd)
oPartnersRange.InsertAfter(CR+"Partners"+CR+CR)
DO WHILE NOT EOF()
oPartnersRange.InsertAfter(CR+CR)
oTable = oDoc.Tables.Add(oPartnersRange,1,2)
oTable.Borders.InsideLineStyle=.t.
oTable.Borders.OutsideLineStyle=.t.
oTable.Columns[1].Width = nOneInch * 3.5
oTable.Columns[2].Width = nOneInch * 3.5
oRange = oTable.Cell(1,1).Range()
oRange.InsertAfter(TRIM(company)+CR)
IF NOT EMPTY(address1)
oRange.InsertAfter(ALLTRIM(address1))
IF NOT EMPTY(address2)
oRange.InsertAfter(", "+ALLTRIM(address2))
ENDIF
oRange.InsertAfter(CR)
ELSE
IF NOT EMPTY(address2)
oRange.InsertAfter(", "+ALLTRIM(address2))
oRange.InsertAfter(CR)
ENDIF
ENDIF
oRange.Underline = wdUnderLineNone
oRange.font.Bold = 0
oRange.font.Size = 11
oRange.font.Name = "Arial"
oRange.ParagraphFormat.LeftIndent = 0
oRange.Collapse(wdCollapseEnd)
oRange = oTable.Cell(1,2).Range()
IF NOT EMPTY(website)
oRange.InsertAfter(ALLTRIM(website)+CR)
endif
oRange.Underline = wdUnderLineNone
oRange.font.Bold = 0
oRange.font.Size = 11
oRange.font.Name = "Arial"
oRange.ParagraphFormat.LeftIndent = 0
oRange.Collapse(wdCollapseEnd)
SKIP
ENDDO
oPartnersRange.Font.Name = "Arial"
oPartnersRange.Font.Size = 12
oPartnersRange.Font.Bold = 1
oPartnersRange.ParagraphFormat.LeftIndent=nOneInch * .5
oPartnersRange.Underline = wdUnderLineSingle
oPartnersRange.Collapse(wdCollapseEnd)
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement