COM And Ms Word
I've read "PHP and COM" by Harish Kamath and I've got a problem just at the beginning.
I'm not able to create an instance of the Word application:
"$word = new COM("word.application") or die("Unable to instantiate application object")".
It doesn't print the die message, it is simply always "sending request to 127.0.0.1 ..."
Is it a problem of "php.ini" settings? I'm using PHP4.0.6 on Windows2000 (Office2000).
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Php & Ms Word
I want to display a .doc file to an html page, using PHP. The doc file is located in a MySQL db. It will be used for displaying some announcements through the main web page.
COM & Word
I am trying to print a document after merging some data into it using PHP COM and it seems to be very tempremental and doesn't work at all over network printers. When I say tempremental, if it works on a machine it works, no question, but if it doesn't it just goes nowhere and doesn't say anything at all. Defintely works on Windows XP Pro, but again tempremental, once it wasn't working and I did everything possible, all office updates etc. but gave up and just re-installed windows and it worked fine. Windows 2000, i think i've had it working Windows 2000 Server, not working. All using Office 2000, but even tried the Office 2003 on Windows 2000 Server and nothing at all.. :( It seems very badly documented. The code I use to print: (a simplified just to do the task) <? $empty = new VARIANT(); com_load_typelib('Word.Application'); $word = new COM('word.application') or die('Unable to load Word'); print "Loaded Word, version {$word->Version} <br/>"; $word->Documents->Open("c:/templates/Options.doc"); $output=""; $word->ActiveDocument->PrintOut(0,0,0,$output); ?> Is there any known good resources for doing this? Can anyone shed any light on this?!
PHP, COM And WORD
I'm having some difficulties with PHP and COM (don't worry I can connect to MS WORD and do stuff). Having desperately Google'd it for 6 hours, here is my lays my last hope.There are two things (Actually three) : 1) a) I want to be able to use styles in WORD to format my created word document. I looked at the list but I just can't seem to find the right command. b) If there is no such use, I want to learn how to create my own styles (the company I'm developing the project has customized heading and subheading styles). So I can mimic Word's settings. 2)I'm having encoding problems. My mysql dbase and browser are working on UTF8. The problem is when I create a word document and dump data on it, the special characters just go crazy. I tried $word->Documents[1]->TextEncoding=20905; but it doesn't seem to work. Maybe I messed with the syntax but code generates no errors. Just crap letters on special characters.
PHP And Word COM
I've just starting to use the COM library with Word 97 and I can create new documents based on the example given in the php manual. I'm running PHP 4.0.4 using OmniHTTPd on a Windows 98 machine - the final version will run from a NT 4.0 server. My problem - I want to do a search an replace to tailor a Word template. The code I have been trying at the foot of this message - basically, all I am doing is converting working VBA into PHP syntax. But PHP crashes as soon as it hits find->execute(). Code:
MS Word To .gif
I need to create preview-images from MS Word documents using PHP. Any Idea how I could accomplish this?
,php To .htm To Ms Word
I've written a (single-page) script that works like this; If no values are posted to it, the script creates a form page for a user to fill in and 'submit'. If values are posted to it (i.e. the user filled in the form), the script renders a page of html with the user-supplied values. Straightforward stuff, however, if values are posted I'd like the rendered page to open in MS word for further editing, instead of the users default browser. What steps can I take to acheve this?
PHP/XML To Word
We use an intranet for the generation of quotes for customers. Once a salesman has selected the quote they can then open it as a word document to edit the details. The word document comes with a customized header for each geographical region. Recently one of the offices moved so we went to the webserver and updated all of the gif's with the new address which will appear before the page is converted to word. Once its converted to word however, the old address appears. I'm at a loss.
Sorting By Word?
Okay, I am making a member database, and when I print it out I want it to display the list by rank. Unfortantly, I stored Rank as a word. I could make a sort function that would be quite extensive and probably take a long time to execute every time... ..Or, is there anyway I can specify in SQL: Put this on the top of the list if "rank='General'" and then next if "rank='Captain'", and so on? I think if this was possible it would take a lot less time to execute... Or else I will probably have to redesign much of the site with numerical ranks instead. Thanks for any answers/advice.
Word & Excel To PDF
I need to convert the DOC (Word and Excel) files in to PDF through PHP code in my web. According to requirement whenever the user upload the .Doc file code should convert that .Doc file into .PDF file at runtime. I am using Linux-PHP-MySQL Technolgoies for development. I am expecting suggestions and help from expert friends who can help me out to achive this.
Open Word From PHP
I am trying to open up word documents, in word, from php. The documents are stored on a web server and access by web dav. when I try opening from php the word documents open in a web browser. If I open word then paste the url in it will open the document in word. Does anyone know of a way of sending a file and getting it to open in word rather than a browser from php.
Word Count
I have a form which users can write a letter and outputs it as $letter - done this, but I need something to count the number of words written.
What Is The Missing Word?
Ascii table alert! SQL-like database General ================= ======= column field row record table ??? What is the missing word?
Faxing Via Word Using COM
I am trying to write a script that faxes a message via MS Word. Does anyone know how to : 1. tell the script to select fax as printer 2. insert recipient's name 3. insert recipient's fax number. The names + numbers are fed from a database The following code actually works but obviously it sends the message to the printer : ... $word = new COM("word.application") or die("Unable to instanciate Word"); $word->visible = true; // open an empty doc $word->Documents->Add(); // type the message $word->Selection->TypeText(' This is a test'); $word->Documents[1]->PrintOut(); //closing word $word->Quit(); //free the object $word->Release(); $word = null; ....
MS Word Documents
I've been asked to write a script to upload Microsoft Word documents and then convert them into 'printer friendly' pages. The uploading part I've got no problem with, but I can't find anything about reading MS word docs into PHP. Does anyone know anything about this? I hope it's not as difficult as excel documents - which I'm still trying to get working on and off without any real success.
Word Document To XML
I want to convert a word template(.doc) to XML such that its DTD is known to me. I is important that I do it in PHP. IS there any way out.Are there some tools available on the net for the same.
Word And Excel
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 SettingssamMijn documentenWerkmapSamhtmlTMP1brqelb8k6.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.
Exploding A Word?
HAven't figured this. I have a word like 'ABC' How would I explode this? My difficulty is that there's no separator to which explode by.
Word (or Other Documents) To PDF On The Fly?
Is there an option to convert any (or mosts file types) a user might upload to PDF format upon upload? I'd like users to be able to upload Word, Excel, Text and other documents, then have our upload script convert the document to PDF on the fly. Then viewing users would simply need the acrobat reader to view files, not all these other office products. Is this possible with just PHP and pdflib for example? If not, what are the options?
Key Word Grabber?
I was just thinking of building an app with PHP. What it's supposed to do is check and see if the user that just accessed the site has been reffered from a search engine or not. If they are from an SE, then check and see what keywords they used to find us and log the site and keywords for later viewing. How difficult will this be if at all possible?
MS Word To HTML
First post. I'm from Argentina, but actually living in Germany for in a practica. I'm looking for a code to convert Word to HTML.
Word To XHTML
I'm looking for a module (COM object/library/anything callable from PHP) to convert Word documents to valid XHTML. Does anyone know of something that does this? It doesn't have to be free.
Saving As WORD
How do i save some text thats is stored in an array... as a Word file ?
Word Count
I was really shocked not to find this already submitted by someone in the PHP manual notes. <? function jnWordCount($text) { $results = array(); $pattern = '/[w0-9]+S+/' // matches wordy characters and numbers preg_match_all($pattern,trim($text),$results); return count($results[0]); } $sentence = ' Should be - (ready) ( 53 ) . , =-' echo jnWordCount($sentence); // outputs 4 // matches: array('Should','be','ready)',ཱ') ?> It counts the number of words ignoring non-wordy charcters and extra whitespace. Infintately better than: <? echo count(explode(' ',$sentence)); ?> Which really only counts the number of spaces not the number of words at all. The reason I'm posting this here is there is just one slight problem. I'm pretty new to regular expressions and they never seem to do exactly what I want. It doesn't seem to want to match single character words. <? echo jnWordCount('a 41 I 5'); // outputs 1. A match for ཥ' only ?>
Word Processing
I use forms (inside php scripts) for adding or changing text on my homepage. I wonder if there is some simple freeware word processing program that I can install on the remote server instead of forms. Which could do simple tasks like change font size or font color and choosing different styles. Or even better a php scrip that do that and is easy to integrate in ones code.
PHP And Microsoft Word
I have users who can sent a Word document as an attachment to an email from a Microsoft-rich environment. I would like to be able to "capture" that attachment as a blob and deposit it into a mysql database. I am not sure how to do the capture.
Word To Html
Hi got "wvHtml", it converts an MS word file to .html, I want to use it without installing on server, I don't know how to use it without installing on server but i am sure its possible.
Saving Word Into .txt
I need to change a sentence from an input text box into words and store it in a text file (file.txt) Eg. "Can someone pls help me" . Can someone pls help me and then store all these into file.txt file.
Word Counter
how do i limit a paragraph to a set number. like if i got a strory and i only want 15 words to show how would i do it? Code:
Word Filter
I know there are many topics regarding Word Filters but I couldn't find one for this particular problem. I want to create a Word-Filter script which ignores workarounds such as spaces (B adword) or BB-codes (Badword). Any ideas on what specific code snippets to prevent those?
Bad Word File
I have a good script called linkman, its very small(u cant compare it to eSyndiCat), any way the main thing it lacks is a way to check if that site title being submitted has erotic content etc. I have below the part of the script and the bits im adding in highlighted in green if all goes well Code:
Pulling First Word
i want to be able to just pull the first part of the person's email address from mydatadase to appear on the page how would i got about doin this?
RegEx Replacing A Whole Word Only..
Just wondered if anyone would care to assist me here? I have the following piece of code.. function replace_word($string,$word,$replacewith){ $string=" $string "; $pattern="[^a-z0-9A-Z]"; $pattern.="$word"; $pattern.="[^a-z0-9A-Z]"; $replacement=" $replacewith "; $string=eregi_replace($pattern,$replacement,$string); $string=trim($string); return $string; }//function replace_word And the unfortunate problem is that if say you feed it <td>Word</td> and the word matches, the end result is <td Word /td> Anyone know how to get round this?
Compare Two Word Documents Using Php
In my system I want to compare two word documents ,but my server is a Linux one and thats y I cant create COM object . Any othermethods to find this one .I think to connect PHP to some other mightt be useful for this.....
Html To Word Convert With Php
Html to word convert with php. Is there any one to help to convert a html php document to convert by doc(Word file).
Using PHP To Add A Word To A Txt File Every X Charachters
Could PHP be used to take a txt file (or set of txt files) and add a string of characters every X number of words or characters? Say a txt file with 50,000 characters/5,000 words how would you go about adding a string of characters every 5,000 characters or 500 words. To improve on this I'd want to if using characters as the guide to use a space or better yet a line break as the point to add the string of characters. So 5,000 characters to the nearest line break.
Effective Word Censor
I have an array of bad words that I wish to sensor out. I need to be able to *** these words out if they are a word on their own. The becomes a problem if they are next to a . ? , ! or alike, Im sure there is a nice quick function someone might have.
Cleaning MS Word Input
I have a problem with a form, and I have tried various permutations of htmlentities() and html_entity_decode() to resolve, but without success. Here is the workflow. 1: User pastes MS Word formatted text into form field. 2: Server uses mail() to send input text to mail client. 3: Recipient pastes text into html file. The problem is that MS Word contains peculiar characters for things like bullets, which come out as tabs, which then come out as different, but spurious, html characters in the html translation. Does anyone know of a function(s) that can clean up MS Word input into something that can be simply pasted as plain text without spurious characters?
PHP To WORD On Linux? COM Object..
Does anyone one if there is a way to generate a word-document with PHP on a Linux box? I've done this on my Win2000 machine with COM objects. But is there a way on a Linux box?
Multi-word Query
I'm trying to figure out how to search a "key_words" column, that contain key words (obviously) for that row. An example of what one of the key_words contains is: "home interior decorating". I can search for "home interior" or "interior decorating" and it will return the correct row, but if I search for "interior home" or "home decorating" I get nothing. I need it to return any row with ALL of those words in any order. I am using WHERE LIKE '%search%'. I have done some searching, but was never quite sure what to really search for. Is there an easy way around this or can someone point me in the right direction?
Unordered Word Search
I've built a search engine that queries a MySQL database. However, if I enter "foo bar", the engine will search for that phrase exactly, and will not find "bar foo" nor "foo something bar". How do you separate words so that the engine finds them individually? I'm thinking something like $tokenized = strtok($query, " ") mysql_query(" SELECT ... FROM ... while(...){ WHERE ...} ")
Word Processing Function
i've been wanting to design a simple for that allows users to input data and then allows me to seperate the data into individual words so that i can seperate last name and first name and with java i could use the tokenizer class but am unsure if there is a similar PHP function in its library, could anyone help me out?
Add Content To Word Or Pdf File Using Php
I would like to have some code in php, which would add some content (e.g. one line) in a ms word or a pdf file (whichever is easiest) that is already stored in the website. To be more specific: I am trying to develop a form that the user would give their name, and pressing a button will send an already written letter (stored in a word file) signed by their name in the end. Please, reply by personal email if possible
Creating A MS Word Document
What i'm trying to do is create a new word document using php, which has a table layout and then put data into the cells in the table. One way I thought was to get php to run some visual basic when it creates the new document but I am no sure how to do this. Also advice on generating word document would be really handy.
Attaching A Word Document
Guys, i have the following code i am using to attach files to an email. It works and does do the attaching, all MS Word documents i attach do not open as they are. Instead they open with unreadable text. Where could i be going wrong? When i change the file type to application/pdf and attach a pdf file, it opens well, just as it is.... <?php $name=$_POST["name"]; $reply_email=$_POST["reply_email"]; $sub=$_POST["subject"]; $attach_file=$_POST["attach_file"]; $sender=$_POST["sender_email"]; $reciever=$_POST["reciever"]; $message_to_send=$_POST["message"]; $multi_receivers=$_POST["bcc_receivers"]; if((empty($name)¦¦empty($reply_email)¦¦empty($sub)¦¦empty($reciever)¦¦ empty($message_to_send)¦¦empty($multi_receivers))){ header("Location:empty.php");} elseif($attach_file=="Yes") { ........
|