Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Word
Message
 
À
30/04/2004 11:48:32
Bhavesh Desai
Apex Softcell (India) Pvt. Ltd.
Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Re: Word
Divers
Thread ID:
00899809
Message ID:
00899910
Vues:
13
>Hi ,
>
> I am trying to create a table of 5 Rows and 2 Columns in word by using ole automation from VFP and then inserting values into the same. Then after that I try to create another independent table of 10 Rows and 6 columns , however I am unable to do so. Can anyone help me out.
>
>Regards and Thanks.
>
>Bhavesh
This is a paste-up of pieces of VFP Word Automation. What you should do is record a Word Macro to build your table, and use this code and other's suggestions to fine tune your VFP/Word Automation. There are other items, like row shading, and fonts and alignment - when you are ready to work on those post us back and we'll see what we can do.
PELsToInches=71.94
with loWord
     .ActiveDocument.Tables.Add(.Selection.Range, 5, 2) && 2 x 5 Table
     oTable=.ActiveDocument.Tables(lnTableCount)
     oTable.Select
     .Selection.Rows.AllowBreakAcrossPages = .f.
     .Selection.Cells.SetHeight(11,2)
     *oTable.Borders(-2).LineStyle=7 && Check Word 
     *oTable.Borders(-4).LineStyle=7 && Sample border style declarations
     * Column Layout
     * Item Column (1)
     oTable.Cell(1,1).Select
     .Selection.SelectColumn
     .Selection.Cells.SetWidth(.6*PELsToInches,0)
     .Selection.ParagraphFormat.LeftIndent = -.07*PELsToInches
     .Selection.ParagraphFormat.Alignment = 2
     * Column (2)
     oTable.Cell(1,2).Select
     .Selection.SelectColumn 
     .Selection.Cells.SetWidth(2.4*PELsToInches,0)
     .Selection.ParagraphFormat.Alignment = 0

     for nTableRow=1 to 5
     oTable.Cell(nTableRow,1).Select
     .Selection.TypeText([Column 1]+trans(nTableRow))
     oTable.Cell(nTableRow,2).Select
     .Selection.TypeText(([Column 2]+trans(nTableRow))
     endfor
     .Selection.EndKey(6)
Endwith &&loWord
Imagination is more important than knowledge
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform