Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a table in Word
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Creating a table in Word
Divers
Thread ID:
00519108
Message ID:
00519108
Vues:
47
I am trying to simulate on a blank [new] word doc what I need to do in the following code. What I ultimately have is a Word template where I have a placeholder called {TABLE 1} where table will be inserted. Once the string that will be the table is inserted, it is not created properly by the ConvertToTable method. Then I lose the range selection object to the string/table where I can not access any of the cell information. Any ideas, please? TIA.
#define CHR_TAB	"	"
#define CHR_CR	chr(13)
local loWord, loDoc, lcString
loWord   = newobject('word.application')
loWord.Visible = .t.
loDoc    = loWord.Documents.Add()
lcString = "Parameters" + CHR_TAB + "Limit" + CHR_TAB + "Average" + chr(13) ;
	 + "Chlorine"   + CHR_TAB + "13.5"  + CHR_TAB + "10"      + chr(13) ;
	 + "Boron"      + CHR_TAB + "55.8"  + CHR_TAB + "45"      + chr(13)
loRange = loDoc.Range()
loRange.InsertAfter("{TABLE 1}")
loRange = loDoc.Range(0,0)
with loRange.Find
   .ClearFormatting()
   .Text = '{TABLE 1}'
   .Replacement.ClearFormatting()
   .Replacement.Text = lcString
   llRetVal = .Execute( , , , , , , , , , , 1)
endwith
loTable = loRange.ConvertToTable(1, , , , 23)  && create a 3 row x 3 col table
? loTable.Cell(1,1).Value
suspend
Mark McCasland
Midlothian, TX USA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform