Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a table in Word
Message
 
 
To
13/06/2001 19:42:02
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00519108
Message ID:
00519165
Views:
14
I made the following code work as for as 3 rows x 3 columns by brute force and making all separators TABS. But I thought the CHR(13) was supposed to work as far as starting a new row.
#define CHR_TAB	chr(9)
#define CHR_CR	chr(13)
local loWord, loDoc, lcString
loWord   = newobject('word.application')
loDoc    = loWord.Documents.Add()
lcString = "Parameters" + CHR_TAB + "Limit" + CHR_TAB + "Average" + CHR_TAB ;
	 + "Chlorine"   + CHR_TAB + "13.5"  + CHR_TAB + "10"      + CHR_TAB ;
	 + "Boron"      + CHR_TAB + "55.8"  + CHR_TAB + "45"
loWord.Visible = .t.
loRange = loDoc.Range()
loRange.InsertAfter("The small brown dog" + CHR_CR + CHR_CR + "{TABLE 1}" + CHR_CR + CHR_CR + "jumped over the low fence." + CHR_CR)
loRange = loDoc.Range(0,0)
with loRange.Find
	.ClearFormatting()
	.Text = '{TABLE 1}'
	.Replacement.ClearFormatting()
	.Replacement.Text = lcString
	llRetVal = .Execute( , , , , , , , , , , 1)
endwith

lnSeparator = 1  && wdSeparateByTabs
lnRows = 3
lnCols = 3
*!*	lnInitialColumnWidth = 10
lnFormat = 23  && wdTableFormatGrid8
*!* ApplyBorders, ApplyShading, ApplyFont, ApplyColor,
*!* ApplyHeadingRows, ApplyLastRow, ApplyFirstColumn,
llApplyLastColumn = .f.
llAutoFit = .t.
*!*	AutoFitBehavior
llDefTblBehave = .t.  &&  DefaultTableBehavior
loTable = loRange.ConvertToTable(lnSeparator, lnRows, lnCols, ,lnFormat, , , , , ,llApplyLastColumn,llAutoFit, ,llDefTblBehave)  && create a 3 row x 3 col table
? loTable.Rows(1).Cells(1).Range.Text
suspend
Mark McCasland
Midlothian, TX USA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform