473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 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 3366
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Microsoft | last post by:
I'm trying to display a word document inside a web page, but everytime I do I get this error: Error Type: Microsoft VBScript runtime (0x800A0046) Permission denied: 'CreateObject' Does...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
2
by: /.. | last post by:
Hi all, I'm working on a report display page that currently uses 5 checkboxlists with a total of 86 items to display values from 5 different tables in an Access database. The page works fine...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
1
by: jpr | last post by:
Hello friends, I have a good question for you. I have a form in Access with a check box named chk1. On the same form I have a code that export my data to a template in MS Word. I use bookmark to...
1
by: ParkMan | last post by:
Hello, I am trying to open a Word template, fill some fields, and mark some check boxes as checked. Here is the code I am using: ' Launch Word and load the report template Set objWord = New...
1
by: jpr | last post by:
Friends, I am having problems in exporting data from my Access db to a word template. On my form I have a check box named check1. On my word template a have a box into which I need to export...
3
by: Jay | last post by:
Hi, I need to read word document file in ASP.net and place it in a text box . How to do it ? i tried : Word.Application app = new Word.ApplicationClass(); object nullobj =...
0
by: dotNetDummi | last post by:
Hi experts, I have a task to print some data into a word document .I need to set the word document to readOnly. It's working but user still can edit. Is there any thing I can do whereby user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.