COM word.application, read checkbox value

This is a discussion on COM word.application, read checkbox value within the PHP Language forums, part of the PHP Programming Forums category; Hi there! I've been trying for days to find a solution anywhere on the web to this problem and ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2006
Patrik Birgersson
 
Posts: n/a
Default COM word.application, read checkbox value

Hi there!

I've been trying for days to find a solution anywhere on the web to
this problem and I hope you might be able to sort me out.

I want to use PHP and COM to set and read values of MS Word form
checkboxes.

I am able to read and write values to text-fields, but I cannot find
the solution for how to call a checkbox. :(

My code (for reading a form text field)...

$file = "path.to.file.doc";
$fnum = 5; // Arbitratry number of form field number

$word = new COM("word.application");
$word->Visible = 1;
$word->Documents->Open($file);
$word->Activate;
$field = $word->ActiveDocument->Fields($fnum); // This is my problem
$data = $fields->Result;
$text = $data->Text;

So, I have been trying to find out what I should use instead of
"Fields".
CheckBox don't work and I haven't found any other clues.

Anyone who knows?


Regards,

Patrik Birgerson

Reply With Quote
  #2 (permalink)  
Old 04-19-2006
Sjoerd
 
Posts: n/a
Default Re: COM word.application, read checkbox value

Isn't a checkbox also in ActiveDocument->Fields? Fields is not limited
to text-fields.

Reply With Quote
  #3 (permalink)  
Old 04-20-2006
Patrik Birgersson
 
Posts: n/a
Default Re: COM word.application, read checkbox value

Well, I thought so too, but it doesn't seem so.
In the Word document there are several text-fields and checkboxes, and
the particular checkboxes I'm interested in lies between som
text-fields.

If I want to call the text-field right after the desired checkbox I use
$word->ActiveDocument->Fields(53);

If the checkbox was also callable by this method then I would get it
with
$word->ActiveDocument->Fields(52);
but then I get the text-field right before the checkboxes.

When I search for this problem I see that in other languages, such as
VB, C#, C++ and others, there are methods for calling checkbox.
(http://msdn2.microsoft.com/en-us/lib...ox(VS.80).aspx)

So, how could I accomplish this with PHP?
Is there perhaps any way to enumerate the callable methods of the
word.application COM object?


Regards,
Patrik Birgersson

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 11:59 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0