Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a table in Word
Message
 
 
À
13/06/2001 19:42:02
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00519108
Message ID:
00519165
Vues:
16
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform