Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get the properties of a WORD doc
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01253682
Message ID:
01254078
Vues:
15
There's no need for additional J varable in the last loop because J=I-1.
*j = 1
For i = 2 To nCount
  .Cell(i, 1).Range.Text = lodoc.BuiltInDocumentProperties(i-1).Name
  .Cell(i, 2).Range.Text = Transform(lodoc.BuiltInDocumentProperties(i-1).Value)
  *j = j + 1
Endfor
>
ON ERROR *
>o = Createobject('word.application')
>lodoc2 = Getfile('doc')
>lodoc = o.documents.Open(lodoc2)
>lodoc3 =o.documents.add()
>nCount = lodoc.BuiltInDocumentProperties.Count
>rng = lodoc3.Range(0,0)
>With rng
>.InsertBefore("Document Statistics")
>.Font.Name = "Verdana"
>.Font.Size = 16
>.InsertParagraphAfter()
>.InsertParagraphAfter()
>.SetRange(rng.End, rng.End)
>Endwith
>rng.Tables.Add(lodoc3.Paragraphs.Item(2).Range,nCount,2)
>With lodoc3.Tables.Item(1)
>.Range.Font.Size = 12
>.Columns.DistributeWidth()
>.Style = "Table Colorful 2"
>Endwith
>With lodoc3.Tables.Item(1)
>.Cell(1, 1).Range.Text = "Document properties"
>.Cell(1, 2).Range.Text = "Value"
>j = 1
>For i = 2 To nCount
>.Cell(i, 1).Range.Text = lodoc.BuiltInDocumentProperties(j).Name
>.Cell(i, 2).Range.Text = Transform(lodoc.BuiltInDocumentProperties(j).Value)
>j = j + 1
>Endfor
>.Select()
>ENDWITH
>lodoc.close
>o.Visible = .T.
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform