Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a table in Word
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Creating a table in Word
Miscellaneous
Thread ID:
00519108
Message ID:
00519108
Views:
46
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
Next
Reply
Map
View

Click here to load this message in the networking platform