473,388 Members | 1,234 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,388 software developers and data experts.

word and excel

Sam
I want php to start MS Word. I tried this but I receive an error:

1 <?php
2 $word = new COM("Word.Application") or die("Unable to instanciate Word");
3 $word->Visible=1
4 $word->Documents->Add("c:/test.doc");
5 $word->Quit();
6 $word->Release();
7 $word = null;
8 ?>

Error:
Warning: (null)(): Invoke() failed: Er is een uitzondering opgetreden. Source: Microsoft Word Description: De opslagruimte voor macro's kan niet worden geopend. in C:\Documents and Settings\sam\Mijn documenten\Werkmap\Sam\html\TMP1brqelb8k6.php on line 4

I tried the same with the Excel-Object:
In that case I don't receive an error but I cannot see the excel-workbook.

What am I doing wrong?
Jul 16 '05 #1
3 7299
There's nothing you can do if a client's MIME types are not successfully
set up in their browser to point application/msword to MS Word. But
since most Windows machines (and most Linux machines running OpenOffice)
do, you can use the following:

<?php
// We'll be outputting a Word Document
header("Content-type: application/msword");

// It will be called worddoc.doc
header("Content-Disposition: attachment; filename=worddoc.doc");

// The file source is in test.doc
readfile('test.doc');
?>

--
Sugapablo :: ru********@sugapablo.com
http://www.sugapablo.com | ICQ:902845

Jul 17 '05 #2
Sam
Actually, I want to do more than just open a Word-document.
I also want to write data to the bookmarks in my Word-document, etc.
It should be possible to do so with the Com-object
(If you go to the www.php.net site and search for 'com' in the function
list, you can see some examples).
One should be able to access the Word-document as from a VB-environment.
It just doesn't seem to work on my machine.
"Sugapablo" <ru********@sugapablo.com> schreef in bericht
news:vm************@corp.supernews.com...
There's nothing you can do if a client's MIME types are not successfully
set up in their browser to point application/msword to MS Word. But
since most Windows machines (and most Linux machines running OpenOffice)
do, you can use the following:

<?php
// We'll be outputting a Word Document
header("Content-type: application/msword");

// It will be called worddoc.doc
header("Content-Disposition: attachment; filename=worddoc.doc");

// The file source is in test.doc
readfile('test.doc');
?>

--
Sugapablo :: ru********@sugapablo.com
http://www.sugapablo.com | ICQ:902845

Jul 17 '05 #3
Sam wrote:
Actually, I want to do more than just open a Word-document.
I also want to write data to the bookmarks in my Word-document, etc.
It should be possible to do so with the Com-object
(If you go to the www.php.net site and search for 'com' in the function
list, you can see some examples).
One should be able to access the Word-document as from a VB-environment.
It just doesn't seem to work on my machine.


Please do not top post.

You could try to save Word files in HTML(XML)
format, then manipulating them will be easier. And
faster, too...Then, after changing, call the COM
object to turn it back into Word document.

--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

41
by: Ruby Tuesday | last post by:
Hi, I was wondering if expert can give me some lite to convert my word table into access database. Note: within each cell of my word table(s), some has multi-line data in it. In addition, there...
6
by: Chris | last post by:
Hi, - How can I open an existing word document from a C#-client and manipulate that document from within the C#-client ? - How can I open an excel document that is embedded in a word-document...
4
by: Chris | last post by:
Hi, everything works apart from the last line :-(( rng.Value2.ToString() An exception is thrown : "Old format or invalid type library" It gets compiled though (so he recognizes the property...
1
by: Bernd Muent | last post by:
Hi together, I am using the following code in Visual Basic to open Word or Excel applications: Word: Dim w As Word.Application w = CType(CreateObject("Word.application"), Word.Application)...
4
by: Lisa | last post by:
Hi - I'm able to open excel workbooks and word documents, but I can't seem to copy excel charts, named ranges, etc. to a word document. Anyone know of good reference material in this area? What...
1
by: Robin Tucker | last post by:
Heres and interesting problem: I have a VB.NET program that creates reports via. Word Automation. This all works fine. What I want to do as part of this report generation process is to embed a...
3
by: herman404 | last post by:
Hi everyone, I have data coming to me in the form of Word and Excel files, and I need to place this data into a SQL Server database. The Word file will be coming in text which is similiar to an...
6
by: Mark Rae | last post by:
Hi, My client has asked me to provide a "quick and dirty" way to export the contents of a DataGrid to both Excel for analysis and Word for editing and printing, so I'm investigating client-side...
1
by: webgirl | last post by:
Hi everyone, I have a weird problem with some Word/Excel automation code that I run from Access (not sure if I should therefore post this in the Access forum..? Thought I'd try here first) ...
7
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear();...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...

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.