Forum Moderators: coopster
Here is a thread that could get you started...
[webmasterworld.com...]
Basically you will have to:
- learn to upload a file
- learn to read that file in line by line
- on reading in the line, learn to split up the values if the line using explode() or split(). This can be a tricky one, depending on if the fields are or are not quote-qualified.
- Learn to output the data to the browser in an intelligible fashion
- usually, this task also entails entering the data correctly into a database, but doesn't sound like that's the case here.
You can get a start at W3c Schools [w3schools.com] and the full details of everything you'd need at PHP.net [php.net]
I have about 100 invoices with packing slips that need printing every day.
The printer is here in the office...on a network. I just want to automate our daily invoice printing. So I think I should be able to make a word template and pull the data with php...right?
Thanks!
Beth
Also, there is a series of printing functions that you may want to use to print: [php.net...]
I'm working on a document that I need to develop in word using php.
Here is the code I tried as a test:
<?php
//1. Instanciate Word
$word = new COM("word.application") or die("Unable to instantiate Word");
//2. specify the MS Word template document (with Bookmark TODAYDATE inside)
$template_file = "C:/reminder.doc";
//3. open the template document
$word->Documents->Open($template_file);
//4. get the current date MM/DD/YYYY
$current_date = date("m/d/Y");
//5. get the bookmark and create a new MS Word Range (to enable text substitution)
$bookmarkname = "TODAYDATE";
$objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname);
$range = $objBookmark->Range;
//6. now substitute the bookmark with actual value
$range->Text = $current_date;
//7. save the template as a new document (c:/reminder_new.doc)
$new_file = "c:/reminder_new.doc";
$word->Documents[1]->SaveAs($new_file);
//8. free the object
$word->Quit();
$word->Release();
$word = null;
?>
Here is the error I got:
Fatal error: Class 'COM' not found
What's wrong? Does this mean that Word isn't on the server? What if it's Godaddy...I wonder if they have word on the servers?
Thanks!
Beth