471,089 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,089 software developers and data experts.

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

Apr 19 '06 #1
2 3207
Isn't a checkbox also in ActiveDocument->Fields? Fields is not limited
to text-fields.

Apr 19 '06 #2
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

Apr 20 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Microsoft | last post: by
2 posts views Thread by /.. | last post: by
7 posts views Thread by R Reyes | last post: by
1 post views Thread by jpr | last post: by
1 post views Thread by ParkMan | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.