Board index » delphi » How access BuiltInDocumentProperties in Word97 or Word2000

How access BuiltInDocumentProperties in Word97 or Word2000

Does anyone know how to access the BuiltInDocumentProperties
of a word document via OLE through Delphi?

I can open the document, but how to access the BuiltInDocumentProperties
such as the Property Title?

I need example of syntax.

Thanks.

Gene

 

Re:How access BuiltInDocumentProperties in Word97 or Word2000


Something along these lines would work:

Str := Doc1.BuiltInDocumentProperties("Title").Value

where Doc1 is a reference to your document.

- Chirag

  TTransitionFX - Perform a variety of image transition effects
  http://chiragdalal.tripod.com/tranfx.html

Quote
"Gene" <ge...@mindspring.com> wrote in message news:3c94f204_1@dnews...
> Does anyone know how to access the BuiltInDocumentProperties
> of a word document via OLE through Delphi?

> I can open the document, but how to access the

BuiltInDocumentProperties
Quote
> such as the Property Title?

> I need example of syntax.

> Thanks.

> Gene

Re:How access BuiltInDocumentProperties in Word97 or Word2000


Hi--
I've tried that syntax, and several variations, but it does not compile with
Delphi.

I get error messages like
[Error] Unit1.pas(61): Missing operator or semicolon
[Error] Unit1.pas(64): Incompatible types: 'String' and 'IDispatch'

with the cursor within the parentheses.

Thanks for any ideas.
Gene

Quote
"Chirag Dalal" <dalal.chi...@iname.com> wrote in message

news:3c957f18_1@dnews...
Quote
> Something along these lines would work:

> Str := Doc1.BuiltInDocumentProperties("Title").Value

> where Doc1 is a reference to your document.

> - Chirag

>   TTransitionFX - Perform a variety of image transition effects
>   http://chiragdalal.tripod.com/tranfx.html

> "Gene" <ge...@mindspring.com> wrote in message news:3c94f204_1@dnews...
> > Does anyone know how to access the BuiltInDocumentProperties
> > of a word document via OLE through Delphi?

> > I can open the document, but how to access the
> BuiltInDocumentProperties
> > such as the Property Title?

> > I need example of syntax.

> > Thanks.

> > Gene

Re:How access BuiltInDocumentProperties in Word97 or Word2000


<<Gene:
how to access the BuiltInDocumentProperties such as the
Property Title?

Quote

Use a variant for the Document to get at these:

var
  Doc: OleVariant;
..
  Doc := Word.ActiveDocument;
  Doc.BuiltInDocumentProperties['Title'].Value
    := 'The title';
  Doc.BuiltInDocumentProperties['Category'].Value
    := 'Category';
  Caption := Doc.BuiltInDocumentProperties['Title'] +
             Doc.BuiltInDocumentProperties['Category'];

--
Deborah Pate (TeamB) http://delphi-jedi.org

  TeamB don't see posts sent via Google or ISPs
  Use the real Borland server: newsgroups.borland.com
  http://www.borland.com/newsgroups/genl_faqs.html

Re:How access BuiltInDocumentProperties in Word97 or Word2000


Hi--

The syntax you have given does not work.
I get the message on compliation

[Error] Unit1.pas(61): Class does not have a default property

Am open to other ideas.  Thanks.

Gene

"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.000010f7.0026d10f@blueyonder.co.not-this-bit.uk...

Quote
> <<Gene:
> how to access the BuiltInDocumentProperties such as the
> Property Title?

> Use a variant for the Document to get at these:

> var
>   Doc: OleVariant;
> ..
>   Doc := Word.ActiveDocument;
>   Doc.BuiltInDocumentProperties['Title'].Value
>     := 'The title';
>   Doc.BuiltInDocumentProperties['Category'].Value
>     := 'Category';
>   Caption := Doc.BuiltInDocumentProperties['Title'] +
>              Doc.BuiltInDocumentProperties['Category'];

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   TeamB don't see posts sent via Google or ISPs
>   Use the real Borland server: newsgroups.borland.com
>   http://www.borland.com/newsgroups/genl_faqs.html

Re:How access BuiltInDocumentProperties in Word97 or Word2000


<<Gene:
The syntax you have given does not work.
I get the message on compliation

[Error] Unit1.pas(61): Class does not have a default
property

Quote

You have ignored the vital first lines of my reply:

 Use a variant for the Document to get at these:

 var
   Doc: OleVariant;
..
   Doc := Word.ActiveDocument;

The reason you must use a variant is exactly to avoid the
compile-time checking you get in early binding.

--
Deborah Pate (TeamB) http://delphi-jedi.org

  TeamB don't see posts sent via Google or ISPs
  Use the real Borland server: newsgroups.borland.com
  http://www.borland.com/newsgroups/genl_faqs.html

Re:How access BuiltInDocumentProperties in Word97 or Word2000


Thank you!! Thank you!! Deborah--
Your code works.

Gene

"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.00001131.000cc802@blueyonder.co.not-this-bit.uk...

Quote
> <<Gene:
> The syntax you have given does not work.
> I get the message on compliation

> [Error] Unit1.pas(61): Class does not have a default
> property

> You have ignored the vital first lines of my reply:

>  Use a variant for the Document to get at these:

>  var
>    Doc: OleVariant;
> ..
>    Doc := Word.ActiveDocument;

> The reason you must use a variant is exactly to avoid the
> compile-time checking you get in early binding.

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   TeamB don't see posts sent via Google or ISPs
>   Use the real Borland server: newsgroups.borland.com
>   http://www.borland.com/newsgroups/genl_faqs.html

Re:How access BuiltInDocumentProperties in Word97 or Word2000


Thank you!! Thank you!! Deborah--
Your code works.

Gene

"Deborah Pate (TeamB)" <d.p...@blueyonder.co.not-this-bit.uk> wrote in
message news:VA.00001131.000cc802@blueyonder.co.not-this-bit.uk...

Quote
> <<Gene:
> The syntax you have given does not work.
> I get the message on compliation

> [Error] Unit1.pas(61): Class does not have a default
> property

> You have ignored the vital first lines of my reply:

>  Use a variant for the Document to get at these:

>  var
>    Doc: OleVariant;
> ..
>    Doc := Word.ActiveDocument;

> The reason you must use a variant is exactly to avoid the
> compile-time checking you get in early binding.

> --
> Deborah Pate (TeamB) http://delphi-jedi.org

>   TeamB don't see posts sent via Google or ISPs
>   Use the real Borland server: newsgroups.borland.com
>   http://www.borland.com/newsgroups/genl_faqs.html

Other Threads