Board index » delphi » Problem with reading objects from Word 2k

Problem with reading objects from Word 2k

Hello,

I'm trying to read text from a textbox in a Word document, and get the
value of a checkbox also in that document (true or false).  I can
successfully open the document, see how many items there are in the
document, etc.  But getting access to what is inside the document is the
problem.  All I need to do is be able to read text from a textbox in the
doc, and get and set the value of a checkbox.

Does anyone have any examples of how to do this?  I'm actully working
with C++ Builder6, but Delphi examples are fine too.

Thanks.

 

Re:Problem with reading objects from Word 2k


<<Luke{*word*106}man:
I'm trying to read text from a textbox in a Word document

Quote

Reading a textbox:

var
  Box: Word2000.Shape;
  BoxNo: OleVariant;
..
  BoxNo := 1;
  Box := Doc.Shapes.Item(BoxNo);
  Caption := Box.TextFrame.TextRange.Text;

--
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:Problem with reading objects from Word 2k


Thanks Deborah,

How about getting the checked or unchecked value of a checkbox?

Thanks again.

Luke
=====

Quote
"Deborah Pate (TeamB)" wrote:
> <<Luke{*word*106}man:
> I'm trying to read text from a textbox in a Word document

> Reading a textbox:

> var
>   Box: Word2000.Shape;
>   BoxNo: OleVariant;
> ..
>   BoxNo := 1;
>   Box := Doc.Shapes.Item(BoxNo);
>   Caption := Box.TextFrame.TextRange.Text;

> --
> 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:Problem with reading objects from Word 2k


Hello again Deborah,

I'm trying that and I'm getting an error at runtime saying:

"(this->get_TextRange((Word_2k::Range**)&prop)) Error:
800A171D(-2146822371)@ c:\borland\...\Word_2k.h\30749"

Have you gotten this error in the past?  It seems like I'm missing a
step here.

Thanks for any insight.

Luke
=====

Quote
"Deborah Pate (TeamB)" wrote:
> <<Luke{*word*106}man:
> I'm trying to read text from a textbox in a Word document

> Reading a textbox:

> var
>   Box: Word2000.Shape;
>   BoxNo: OleVariant;
> ..
>   BoxNo := 1;
>   Box := Doc.Shapes.Item(BoxNo);
>   Caption := Box.TextFrame.TextRange.Text;

> --
> 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