Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word Automation
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01526291
Message ID:
01526298
Vues:
43
>Have a table in a word document (created problematically) I want to be able to bold the first insertion and have the second not bold in the same cell. Can't find a way to make this work, or any other method for that matter.
>
>
>oWord.ActiveDocument.Tables.Add(oRange, 4, 4, 1, 0)
>oTable = oWord.ActiveDocument.Tables(1)
>nCounter = 1
>
>WITH oTable
> .Cell(nCounter,1).Range.InsertAfter('Now is the time for all good men to come to the aid of their country')
> .Cell(nCounter,1).RANGE.Font.Size = 10
> .Cell(nCounter,1).RANGE.Font.Bold = .T.
> .Cell(nCounter,1).RANGE.Font.Name = 'Times New Roman'
> .Cell(nCounter,1).RANGE.Collapse(wdCollapseEnd)
>
> .Cell(nCounter,1).RANGE.InsertAfter('More Text')
> .Cell(nCounter,1).RANGE.Font.Size = 10
> .Cell(nCounter,1).RANGE.Font.Bold = .F.
> .Cell(nCounter,1).RANGE.Font.Name = 'Times New Roman'
> .Cell(nCounter,1).RANGE.Collapse(wdCollapseEnd)
>ENDWITH


Not well tested:
#define wdParagraph 4

LOCAL oWord AS Word.Application
LOCAL oTable AS Word.Table

oWord = CREATEOBJECT([Word.Application])
oWord.Visible = .t.
oWord.Documents.Add()
oRange = oWord
oWord.ActiveDocument.Tables.Add(oWord.Selection.Range, 4,4)
oTable = oWord.ActiveDocument.Tables(1)
nCounter = 1

oTable.Style = "Table Grid"
oTable.Cell(nCounter,1).Select()

oWord.Selection.TypeText('Now is the time for all good men to come to the aid of their country')
oWord.Selection.TypeParagraph
oWord.Selection.MoveUp(wdParagraph, 1, 1)
oWord.Selection.Font.Size = 10
oWord.Selection.Font.Bold = .T.
oWord.Selection.Font.Name = 'Times New Roman'
oWord.Selection.MoveDown(wdParagraph, 1)

oWord.Selection.TypeText('More Text')
oWord.Selection.MoveUp(wdParagraph, 1, 1)
oWord.Selection.Font.Bold = .f.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform