Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a table in Word
Message
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00519108
Message ID:
00519177
Views:
11
This message has been marked as a message which has helped to the initial question of the thread.
Mark,

Here's a technique I use:

* method WordHelper.TableBuild
lparameters raColumnHeaders, pnColumns

* raColumnHeaders = array of header text to put in the first row
* pnColumns = number of columns in the array/current work area

dimension raColumnHeaders[pnColumns]

local loRange, loTable, loCell, i, j, lnRecno

lnRecno = recno()

with this.moWord.Selection
   loRange = .Range
   loTable = this.moWord.ActiveDocument.Tables.Add( loRange, reccount() + 1, pnColumns )
   for j = 1 to pnColumns
      loCell = loTable.Cell( 1, j )
      loCell.Range.InsertAfter( raColumnHeaders[j] )
   endfor

   for i = 1 to reccount()
      goto i

      scatter to laRow
      for j = 1 to pnColumns
         if ( type( "laRow[j]" ) == "C" )
            laRow[j] = alltrim( laRow[j] )
         endif
         loCell = loTable.Cell(i+1,j)
         loCell.Range.InsertAfter( laRow[j] )
      endfor
   endfor

endwith

goto lnRecno

this.TableAutoFit( loTable )

return loTable
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform