Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating a table in Word
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00519108
Message ID:
00519177
Vues:
12
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform