Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Reading Microsoft Office Documents?


I need to be able to upload a Microsoft office document and then show the contents to the visitor, in addition i need to be able to  write documents on the fly.

Is there a way of doing this, or will i have to spend days researching and programming my own classes to handle it?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Can I Convert MySQL Db Records Into Microsoft Word Documents?
i found the solution to export
file from mysql db into *.csv. but is there anyway to convert the
contents into *.doc and save in my webserver and providing a link for
the end users to download the word file?

FYI, the database records are obtained by end users submitting the
forms themselve and i saved it in my db...

Reading EXCEL (XLS) Documents With Other Charactersets
(the other code i cannot post due weird carakters!)

I've been searching over the internet for days but havent found why! i've tried alot of scripts (both free or wich i need to pay for) but only a pricy script (like 80$) would show the carakters in ROW C correctly. If i convert the script to a HTML document i get the carakters with &# and a four digit number... that's what i like to extract from the excel sheet.

The script i wrote is.

Code:
<?php
$excel = new COM("excel.application") or die("Unable to instanciate excel");

//bring it to front
$excel->Visible = 1;//NOT
//dont want alerts ... run silent
$excel->DisplayAlerts = 1;

//open document
$excel->Workbooks->Open("d:/excel.xls");

for ($h = 1; $h <= 3; $h++)
{
$book = $excel->Workbooks(1);
$sheet = $book->Worksheets($h);

echo "<table>
";
//Wtite row
for ($i = 1; $i <= 150; $i++)
{
echo "<tr>
";
//write colom
for ($j = 1; $j <= 5; $j++)
{
$cell = $sheet->Cells($i, $j); // #Select the cell (Row Column number)
$cell->activate; // #Activate the cell

if($cell->value == &#390;')
{
$td = "";
}
else
{
$td = $cell->value;
}

echo "<td>" . $td . "</td>
"; // #write the cell
}
echo "</tr>
";
}
echo "</table>
";
}

//closing excel
$excel->Quit();
?>

SQL Error: [Microsoft][ODBC Microsoft Access Driver] Too Few Parameters
I'm trying to execute the following SQL statement and get the following error.

SELECT DomainNames.DomainName FROM DomainNames WHERE DomainNames.DomainName Like "*ab*" ORDER BY DomainNames.DomainName

SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect

I'm running PHP4, Apache 1.3.12 (Win32) and connecting to an Access database on a Win2K box.

Odbc_exec(): SQL Error: [Microsoft][ODBC Microsoft Access Driver]
i am trying to write to the database through odbc. i get the following error:

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query., SQL state S1000 in SQLExecDirect in c:inetpubwwwroot514VIP_SurveyProcess.php on line 41

my directory has read/write permissions why am i getting this? here is the code as an example:
...
$x = 10;
$querySet = "UPDATE Survey SET $rdoOption = $x";
odbc_exec($objConn, $querySet);
...

Office 2004, Where 1 + 3 = 40
I couldn't understand why our Christmas letter, containing two photos
and some text, should be 1.3Mbytes in size. I thought perhaps one of the
pix had not been reduced in size before embedding in the Word doc. I
decided to reproduce the letter (I also though that perhaps the letter,
which my wife has edited stuff into and out of for the last ten years,
was suffering from a bit of garbage non-collection a la Page maker), and
did this:

1) Made a new blank doc, and copy/pasted just the text from the existing
doc. Saved. So far so good, its only 32k.

2) Trimmed the picture and saved at lower res - good, that's only 88k.

3) Did insert picture into the so-far text-only doc and saved. Agggh,
suddenly its 1.3Mbytes.

Another problem I had - I inserted an item of clip-art, and managed to
send it behind the text. Thereafter, I was unable to select the clipart
item at all. Any attempt to click or right-click it brought up the
insert-picture dialogue. In the end, I decided to see what happened if I
did the insert picture. The clip-art vanished and whatever picture I
chose took its place.

PHP Mail Attachment Works Except In Windows XP Office
Short description:
I've got a product (myprod.mxp) which I deliver via email and it works in Windows 2000 Office, Yahoo, etc - but not in Windows XP Office. I can attach the file in Yahoo and it makes it to the Windows XP Office account - so something needs to be changed in the script *or* I need another script to send out the attachment.

Long description:

Here is the script I am using to email the product to the customer, what changes should I make to allow Windows XP Office to receive the email attachment, it comes across inline with the message (long string of garbage characters)

Office Document Upload To Website (and Inserting In MySQL If Possible)
I would like to upload office-document (doc, xls, ...) using a form to a
website (apache, php, mysql) in a specific directory and if possible insert
it into a table (MySQL-db). Is this possible. If yes, how ? You don't have
to explain it in detail, a link to a website or online manual or example is
fine.

Group-Office / IMAP EMail - Wrong Date Display ??!!
I installed the Community Version of the Group-Software GroupOffice (http://www.group-office.com) on my Webserver.

Group-Office got a module for webmail (IMAP/POP3 eMail-Server). I copied my mail on my IMAP-Server. There are two diffentent views form the mails, a Listview and a Detailview of the selected mail. I think in the Listview there is a wrong eMaildate - It´s the date the mail saved on the server.

In my case there are many mails with the same date, because I copied a lot of them at the same day in the IMAP Folder. The Detailview displays the right emaildate, the date of sending the mail.

There are two different PHP-Files, one for the listenview (messages.php) und one for the datailview (message.php). I think I found the lines of each file for retrieving and displaying the dates. Code:

Generating .pdf Documents On The Fly...
Does anyone know if it's possible to generate pdf documents from content held in a database? The idea is to use a template to dynamically generate pdf documents on the fly based on what the data a user has selected on a site. Is this possible with PHP/ ASP?

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 (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?

Creating XML Documents
I'm trying to get myself to grips with XML and PHP, I've been through the XML parsing tutorials here and they are very good.

However, what is the best way of doing the reverse, i.e. actually dynamically creating XML documents in PHP as opposed to parsing them? Is there a library for doing this, or is it best just to do it from scratch?

Printing Documents
I have a web page that displays CVs submitted by users (in DOC, PDF or RTF format). CVs are stored in a folder for e.g. user_cv Admin can select the CVs to be printed and then click on Print button. This should send all documents to printer for printing. How do I do that in PHP?

PHP On Microsoft-IIS/6.0
Is it possible to make IIS parse .html files the same way as Apache does
with AddType application/x-httpd-php .html in .htaccess?

SSI And Perl Within .php3 Documents
Im new to PHP. I want to know if you can use ssi within .php3 documents and call php3 funtions in a .pl scritp.
That is if you want to use the useful perl scripts you find on the web and combine them with php.

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.....

Phplib Creating Pdf Documents
I can load a font, set a font, load an image, draw a line, output text in a box, output text on a line, create a pdf, open a pdf, add a page, close a page, close a pdf but I can not set a font to bold or italic or underlined.

I currently use a function which moves the text position slightly and re outputs it for bold and I simply draw line for underlined text but now I need to do italicized and I am stuck.

I found little on font styles anywhere when using the pdf commands on php.net I can see the list of commands but everything is deprecated and the new commands don't have clear documentation on how to use them:

pdf_setfont($pdf, $times, 9);
pdf_setcolor($pdf,"both","rgb",0,0,0);
pdf_set_parameter($pdf,"fontstyle","italic");

the first line sets the font to be times roman and size 9 the second change the color to black I though the last line would set the font to be italic but it is not correct Any ideas?

Parsing Existing PDF Documents
I have an existing PDF document; "myfile.pdf". I want to be able to seek through that document for particular strings. The thing is, I can't find a way to open the file as something that's legible/readable.

I've tried using PDFLib aswell as using fopen/fgets (among many other things) to open the file and display the content. The only content I get is a little mark-up and a bunch of garbbled text.

I'm assuming that when a PDF is created it has some form of character encoding passed over it, or it's encrypted in some way. I've looked at a few classes around, but none show ways of opening a PDF document up.

How To Upload Documents In Mysql
I'm a beginner and will like to know how to upload documents in mysql. These documents will be cited on the intranet and a user will have to search for a particular document using either date, title etc.

Downloading Secure Documents
i'm building a site which will have a secure section (still haven't decided between cookies and sessions), but anyhow, after the login screen, there will be links to a bunch of word documents that the user can download or view. I'm thinking anyone who knows the path to those documents can view them without logging in.. is there a way to prevent this? or am I just wrong?

Microsoft SQL Connection
I am looking to have a php page that will have a required include of a
config file with the MS SQL connection creation. I want to have a form
that saves into a MS SQL database. Could call out to a stored
procedure or have inline code in the php page.

Anyone have examples or generic sample code I can use?

PHP With Microsoft Sharepoint ?
I would like to ask if I can synchronize Sharepoint Services with my PHP
website?

Hint: I think it can be done by XML as a bridge.. but I am not sure and
wanna be sure.

PHP And Microsoft Access
Is it possible to use php to interface with an ms access database?

Our current database (customers, suppliers etc) is in ms access format and we need to run msaccess. I dont feel like converting the whole database over to mysql and we still need the original system, the idea will be that the staff can access the database on the road thru a webpage.

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.

PHP To Microsoft Outlook
Is it possible to send meeting notifications to microsoft outlook through php? I guess it would be sort of an e-mail sent to an individual telling them they have been invited to attend an event and the event info is automatically added to thier outlook calender or something?

Evaluating Php Tags/documents Outside Of Web Server?
I need to generate and send multiple xml documents over a socket.

Is it feasible to use php as a templating language for these? How would
i go about that?

I figure i _could_ make them into 'normal pages' and fetch the contents
using some http library, but that doesn't sound too elegant. There has
to be a better way?

Tutorials/Articles/Documents Script?
I was looking for a script that could let me manage tutorials, articles or documents in my website. There should be categories and they are not for download but to be displayed right on the page, extra functions like rating, comments would be nice but not required.

I'm currently using Tutorials Manager (http://scripts.phpwiz.net/tb2/) but the script is in beta state and is quite buggy. If anyone knows about any others scripts, please let me know all of them so I can choose one. Free ones or under the GPL only.

PDF Generation - Making Large Documents
I am trying to generate a large PDF using PDFLib. Specifically, I have a database of University researchers (perhaps 300-400) and I need to generate a printed report with a table of contents - all of the entries are stored in a MySQL database.

There can be several researchers / page and I want to avoid a researcher's entry spanning two pages.

I think PDFLib would be a good solution for me, but all the examples / tutorials I have seen using it have been quite trivial.

I wonder if anyone has some tips / tricks for using PDFLib for text spanning several pages or if you can think of a better way to generate this larger document for print - keeping in mind that I must keep track of page numbers.

Extract Text From Word Documents
Is there a way to extract the text of a word document with php? And perhaps some of the formatting (like break lines, bold, italic,...)?

Algorithm For Detecting/highlighting Changes In Documents
Anyone knows a good algorithm for detecting difference between two
pieces of text? I'm working on a content management system and would
like to add the ability to highlight changes made between versions. I
don't think diff is suitable here, since I want word level detection.
Besides, I'll need to handle a large number of relatively short
strings. Spawning an process for each would be too time consuming.

AFAIK, PHP doesn't have a build-in function. If necessary, I can build
a wrapper extension.

Automatically Download Documents Onload
i have another problem with regards to documents. The thing is, when a user registers, they upload a document right, and we store the document's link and the date it was loaded on the database, but now i would like this to happen, that when i log in and there has been a dcument uploaded, it takes the date now and compares it with the date that the document was loaded, like this: Code:

Multiple Forms, Different PHP Documents, Same Page?
In a PHP file 'main.php' I have

<?php
include 'header.php';
include 'login.php';
include 'body.php';
include 'footer.php';?>

Login.php has a form on it to allow the user to log in to the site.

Body.php has a form on it to allow a user to post a message.

What I'm finding is that the 'submit' button on 'body.php' actually calls the form from 'login.php'. Does PHP have issues when there are 2 separate forms doing 2 saperate things displayed on the same page - is there anything I need to look out for?

Uploading Documents To Multiple Servers At Once
I have two servers: Server X and Server Y.  I'm looking for a solution so that when users upload their documents to server X, they also upload to server Y to the same folder and directory.  This way, if server X is down, we can still access the uploaded documents through server Y.

Secure Login Area For Documents
I built a login area with a document manager.  It works great and all and all the pages are secure.  My question though if the pages are protected by php and you can't get to them, how do you keep someone from linking to the document directly.  Since the document is not going to process the php and check for credentials when they put in the direct link to the document.

Exporting To Microsoft Access
I have a PHP website with a mySQL database and a client wants to be able to see the database on his computer using Microsoft Access.

I would like to be able to make a special backdoor section for him, where he enters his username and password and is given a link which will make take a snapshot of the mySQL database and convert it to a Microsoft Access database which he can download to his computer.

Is this possible?

Since he isn't very computer savvy I need a way as user friendly as possible to let him download the database and view on his local computer.

Microsoft Exchange Server
Do any of you know a free PHP script that does the same stuff as Microsoft
Exchange Server?

Microsoft SAPI Problem With PHP
As I've found tons of VB and C# sample codes, I was trying to transform

it into PHP code, using the COM objects. My aim is to create a simple
html, that creates a wav from a text. Here's what I've tried -the php
script part-:

$Voice = new COM("SAPI.SpVoice");//works
//com_load_typelib("SAPI.SpVoice"); //This doesn't help...
$Voice->Speak("Hello!"); //works

$FileStream = new COM("SAPI.SpFileStream"); //works - I mean no error
$FileMode = SpeechStreamFileMode.SSFMCreateForWrite;// = 3 //works -
no error
$FileStream->Open("c:a.wav", 3, false); //works - no error
$Voice->AllowAudioOutputFormatChangesOnNextSet = false; //works - no
error
$Voice->AudioOutputStream = $FileStream; //HERE'S THE PROBLEM

$Voice->Speak("Hello world",1);
$FileStream->Close();

Here's the error I get for that line:
Uncaught exception 'com_exception' with message 'Error [0x80020003]
Member not found

PHP Wrapper For Microsoft SAPI
I can not figure out the reason why this does not go past step 2, it will not go to 2a. Code:

Microsoft Access -> PhpMyAdmin
Alright, so what’s going on is that I have coded an entire website with in mind to have an Access Database. So everything works great...

But now I am faced with the problem that I have to have my webpage work with phpMyAdmin, which works completely differently in running my sql statements and everything, ie: ->EOF, select statement, etc...

Is there a way for me to have a smooth transition for my code to work with phpMyAdmin instead of Access at the moment, because recoding all of this means an enormous amount of work with not much free time left on my hands. Code:

Microsoft Word Formatter
Anyone know of some sort of php script that can read and format Microsoft word documents?

Trouble With Counting New Documents With Complex Query
width formulating the most
effective (in terms of processing time)
SQL query to count all the "new"
documents in the repository, where "new" is
defined as "from 00:00:01 up to 23:59:59
today". My current query does not give me
satisfactory results, it creates a visible
delay in rendering of the main page of one of
the departments (Drugs) :8[[[
(at least I, for now, think it's the culprit).
It's for the <url: https://hyperreal.info >
site, see for yourself, notice the delay
<url: https://hyperreal.info/drugs/go.to/index >.

Currently I ask MySQL to (offending
PHP fragment follows, I hope it is self-
explanatory)....

Unexpected Behavior When Creating Xhtml Documents
The following has been posted before (2 years ago) but no response was
added. Therefor again, the following code for creating xhtml file:

<?php

error_reporting(6143);

$xmlns = "http://www.w3.org/1999/xhtml";
$lang = "en";

$xhtml_1_strict = new DomImplementation();

$dtd_xhtml_1_strict = $xhtml_1_strict->createDocumentType("html", "-//
W3C//DTD XHTML 1.0 Strict//EN", "http://www.w3.org/TR/xhtml1/DTD/
xhtml1-strict.dtd");

$xhtml_1_strict_document = $xhtml_1_strict->createDocument("", "",
$dtd_xhtml_1_strict);
$xhtml_1_strict_document->encoding = "UTF-8";
$xhtml_1_strict_document->standalone = "no";


PHP / Microsoft SQL V7/2000 - Page Results
Anyone know a simple way to page results of a SQL Select using Microsoft SQL ? I don't believe they have anything as handy as MySQL LIMIT.

Parse Error For Microsoft.XMLHTTP
I want the following ASP code to be rewritten in PHP:

<%
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://www.mydomain.com", False
xml.Send
Response.Write(xml.responseText)
%>

I tried myself with ASP2PHP conversion tool. The following code was generated. But does not work. I get a parse error. Please help!

<?PHP
$xml->Open "GET" "http://www.mydomain.com" $False;
$xml->Send;
echo $xml->responseText;
?>

How To Embed Microsoft Word In A Page Using Php
how to embed or open microsoft word file in a page using php script

Any Ideas How To Run Macro In Microsoft Publisher Through PHP COM ?
my macro in Publisher changes "123" into "321" (example)
but I can't be able to run it.
This is how far I get throught with PHP & Publisher:

<?
$pub = new COM('publisher.application') or die('Unable to load
Publisher');
print "Loaded Publisher, version {$word->Version}
";

$pub->Open('xxx.pub');

$pub->Documents[1]->SaveAs('xxx2.pub');

$pub = null;

?>

this works, but of course does not do anything else than open xxx.pub
and save it as xxx2.pub. I am trying to run my macro:

$pub->Documents[1]->RunMacro(replaceme);

where replaceme is my macro. I tried different variations:

$pub->Documents[1]->Run(replaceme);
$pub->Documents[1]->Application->Run(replaceme),

etc but no luck so far :(

Microsoft Access Dropdown List
l am building a new site using PHP which has a lot of pages pulling from an Access Database. I would like to have a dropdown list that pulls exhibitions from the database and then when the user selects one it shows the rest of the details from DB just below the dropdown list, hope that makes sense. Code:

PHP Will Not Read More Than 4096 From My Microsoft Sql Text Field.
I have a textarea that is saving to a mssql text (very large) field. The insert, update is working fine. However, when php reads the data using mssql_result function, I'm getting limited to 4096 characters read by php. I know that there are at least 6000 characters and I can see them using microsoft's query analyzer. This is not a magic quotes, single quote, quote, html entity or anthing like that. PHP will not read more than 4096 from my microsoft sql text field. Any ideas how I can get php to read more?

Insert Into Microsoft Access Table Using ODBC
The following lines of code don't return an error but they also do not insert the row into the database:

$SQLText="Insert into member (MailingID, MemberID, [File As], EMail, LetterID, AudienceID, DateSent, Sent) Select $MailingCode, $row[0], '".$row[5]."', '".$row[6]."', $LIDToInsert, $AIDToInsert, '".$DateSent."', 1;";

print '<br>'.$SQLText;

$rs_upd=odbc_exec($link, $SQLText);

if (!$rs_upd) die("Couldn't update database");

I've tested the resulting $SQLText string in Access directly and it works find there so this must be a PHP or ODBC issue.


Copyright © 2005-08 www.BigResource.com, All rights reserved