So I save .docx files in my database as mediumblob, when I want to show it, it looks like this:
PK!ߤ�lZ [Content_Types].xml
I already have a class that can read this, but that class needs a file and can't read from the database directly:
How to extract text from word file .doc,docx,.xlsx,.pptx php
Is there a way to directly read this from the database without needing to use file_put_contents();?
Thank you for helping.
Related
I am pretty new to PHP and MySQL, and brand new to PHPWord. I have done multiple searches and cannot find the solution I am looking for.
I already have the PHP code to extract the plain text from an actual docx file located on the Windows file system.
My situation:
Some MS Word docx files are stored as blobs in the database using base64_encode(). I need to find a specified string in one or more of these files.
No rows are returned when I attempted to use FROM_BASE64('columnname') because the data is in the docx format, so the string does not match anything in the data.
Then I used a simple SELECT to get a docx file into a string variable.
I would like to avoid creating a temporary file to parse using PHPWord which would have to be done for each docx file.
My question(s):
Is there a way to use the string variable as the source for PHPWord processing? Or does PHPWord require the source to be an actual file on the file system?
I am trying to use PHP to read the text from a PDF file that is stored in a mysql database. I tried using class.pdf2text.php, which works with an actual file. I tried to use the MYSQL_RESULT variable with the pdf file contents with that class, but it doesn't work. I've got to be missing something really easy, I just know it.
Basically, this is what I'm trying to do:
I have a database with PDF files. I need to convert a PDF from that database to text and then search on that text for certain data. Is there a way to do this without creating external files in PHP?
I want to select a file and display its contents as it is in the browser. Can anyone suggest me how to do this?
Here is a library that reads contents of csv file and displays it as table. It is basically a class. if you have object oriented concepts you can do with it.
View my answer
Codeigniter REST CSV import to mysql
I need to implement a functionality where a user can upload an Excel file, that is, .xls file and i need to write a function that will read that file and then save the values in a table, compare them to values in another table and then print some kind of billing quotation.
From what I have read, it seems that the best way to do that is to first convert that file to an xml file and then write a function to parse that xml file.
I want to know, is it possible to write a function in php that will convert an xls file to xml. Assuming that the users will save and upload the file as xls.
Thanks.
i often let admin users upload a csv file they exported from an xcel file, its much simpler to parse through using http://php.net/manual/en/function.fgetcsv.php
A quick Google search for "PHP excel parser" turns up PHP Excel Reader, for an open source library to use for reading data from .xls files. There may be others that suit your needs.
I have been successfully using the 'ABC Excel Parser Pro' from Zakkis.
This allows converting from a XLS file directly into a MySQL table.
A few notes on limitations:
column count must match exactly to database columns
Excel 2007 format (xlsx) are not supported
My PHP script have to create a multi-tabs Excel file with a report in each tab, but those reports already exists as HTML pages, so I don't want to duplicate code and work.
I know I can rename a HTML file to .xls, and Excel/OpenOffice Calc will open it as a spreadsheet, but I don't know how to have severals tabs.
I do not even know if it is possible.
I already know Biffwriter and others PHP libs to create Excel file, but I am looking for a smarter solution.
Thanks,
Cédric
Pear Excel Spreadsheet Writer has a function to create new Worksheets if thats what you are looking for.
If you don't mind serving excel 2007 files, you can do this:
create an excel 2007 file
create all the tabs you need
save the file
rename the file as .zip
extract the contents of the zip file
Now you can use the file structure there to populate the file corresponding to each tab with the report you need. You may want to use them as templates, keep the same code and render different files depending on whether you generate the html report of the excel report.
In the end, zip up the entire directory structure and serve it with an xlsx extension.
Please check the URLS of
a library
and
turorials
from IBM and
from 999Tutorials