473,657 Members | 2,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

COM word.applicatio n, 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.d oc";
$fnum = 5; // Arbitratry number of form field number

$word = new COM("word.appli cation");
$word->Visible = 1;
$word->Documents->Open($file);
$word->Activate;
$field = $word->ActiveDocume nt->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 3387
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->ActiveDocume nt->Fields(53);

If the checkbox was also callable by this method then I would get it
with
$word->ActiveDocume nt->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.applicatio n 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
16169
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 anybody know the correct way to do this? I don't want to link to a document, but rather display a word file inside the asp page.
9
3958
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 will not set the value of the control and will leave the checked status of the checkbox to false when a user selects a new date. this works fine when using the control on a win2k machine but if we use it on a win XP box and call
2
9195
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 now. On presenting it to the users they pointed out that their users could change the values in the checkboxes and then print them out, ultimately documenting false information.
7
10953
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 this screen below. Please help, thanks in advance... Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify...
1
3794
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 export my access data. No problem with regular data but cannot handle checkboxes. Basically I need help to export the check box value (yes or no) into a check box places in my word template. In this template I have a checkbox. If I doulble click in...
1
4639
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 Word.Application objWord.Documents.Add _ Application.CurrentProject.Path & "\PEFA_Field_Sheet.dot" objWord.Visible = True
1
3391
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 the value I enter in the check box. My checkbox in word is bookmarked. Something is not working proberly. The following code does not check
3
9777
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 = System.Reflection.Missing.Value; object file = @"C:\Suneetha\Ques.doc"; Word.Document doc = app.Documents.Open( ref file, ref nullobj, ref nullobj,
0
1183
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 cannot edit the document? // Word.ApplicationClass oWordApp = new Word.ApplicationClass(); // object missing = System.Reflection.Missing.Value; // object readOnly = true; // object...
0
8326
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8845
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8622
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4333
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2745
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.