Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
There are 8 columns that I want to save in the excel file. How do I use PHP to create, access and edit Microsoft Excel files?
I think this is what you want.
https://github.com/PHPOffice/PHPExcel#phpexcel---openxml---read-write-and-create-spreadsheet-documents-in-php---spreadsheet-engine
PHPExcel is a library that can handle Excel files, and some other file formats. If you only have this 8 columns you than just set the data with
$objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Content');
...
$objPHPExcel->getActiveSheet()->SetCellValue('H1', 'Content');
And have a look at the hello word example, this will guide you how to create a simple xlsx file.
Check out https://phpexcel.codeplex.com/
It provides some very cool features to manipulate Excel files. You can find a couple of examples here: https://phpexcel.codeplex.com/wikipage?title=Examples&referringTitle=Home
PHPExcel is what you want, you can download from
https://phpexcel.codeplex.com/
Be careful when managing huge spreadsheets, because PHPExcel consumes lots of memory.
If you only need output a simple excel file with non formatted data, you can output the data in comma separated values (CSV)
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
i am new developer in PHP and need learn if there is a way to copy content from an excel sheet and paste it into a php site, simulating an excel spreadsheet in PHP and be able to edit the pasted information.
Finally enter this information in a SQL database.
I know that you can upload a file and recover the data from there, but it is not an option in this project
Any advice or help is appreciated.
Thank you
Theres a lot of aspects to what you want to achieve but a few points to get you started. You can use the JExcel plugin in order to simulate a spreadsheet in the browser, however the spreadsheet itself uses HTML and JavaScript. Its possible to copy cells from excel and paste them into the JExcel table, you can then edit cells, add new cells etc.
You can then pass the data from the table to PHP using an AJAX call (JExcel provides methods to do this), im currently doing a project that does exactly this and it works very well. You can then do what you want with the saved data, e.g. insert it into a DB from PHP.
Hope this helps get you started.
PhpSpreadsheet is what you are looking for. There is another library which is dead, phpexcel, spreadsheet is a decendent of this.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to display some pdf file on my website, but I do not want people to download the file. like scribd.com that displays the document.
anyone can help me?
If you want to make sure your user cannot download the original PDF file you will have to convert it to something else before.
Scribd converts the PDF to HTML (with one image in the background that contains all non-text objects). I am not aware of any PDF to HTML parsers, so you would have to write your own. Due to the nature of PDF files, this will unfortunately not be easy (see this question for some more details: Convert PDF to HTML in PHP?)
If you are fine with relying on some external web service, you might try this: https://cloudconvert.org/pdf-to-html
As an alternative to parsing the PDF to HTML, you could also just output it as an image. This is much easier to achieve but also not very nice in terms of user experience. If you chose this method, the easiest way would be to use ImageMagick and Ghostscript (see https://stackoverflow.com/a/467805):
<?php
$im = new imagick('file.pdf[0]');
$im->setImageFormat('jpg');
header('Content-Type: image/jpeg');
echo $im;
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to send the doc and pdf file to the MySQL database using php from my android application.
I have no idea about it. What shoud i write in android and php file?
Please guide me if anyone have code?
Thanking you.
You have two options:
1) Store it in a field with a BLOB data type. I really do not advise this in any way and is only listed as the first option because it pertains directly to your question.
SO has good coverage of this already Storing files in SQL Server
2) Move the file to a folder and store the file path. This is the preferred option by mmmm everyone. Use move_uploaded_file and if you are unsure of how to setup an html form take a look at W3C PHP File Upload
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I am looking for a php library which supports accepting an excel file (like .xls or .xlsx) and then some sort of functionality to create an array populated with values of each column. (Separate arrays).
I know there might not be a read to use solution thus I thought about programming it. However, I was wondering which library could I use for several scenarios?
The few I cam across were
https://github.com/PHPOffice/PHPExcel
http://sourceforge.net/projects/phpexcelreader/
https://github.com/PHPOffice/PHPExcel
I have no idea which one use, though codeplex one seems to be most functional, but I don't want to use a too heavy php library and then not end up using 90% of the code.
Also depending of the framework which one could fit better?
PHPExcel is the great library. I prefer to use it!
You can also take a look an example of this library on CodeIgniter here
I use PHPExcel at codeplex! They have great support there! Also it is very lightweight and has great documentation!
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to make spreadsheet able to expand cell when the data needed to be filled into it exceeds cell width.
I am using export in a website using php and on opening it in Excel the cell doesn't adjust in width
If you are exporting it as a CSV you're out of luck, how the spreadsheet software handles those files is completely up to the software itself, no way to influence/enforce it with PHP.
A possible solution is exporting it as an Excel dot-xls file, not a CSV. That's easily achieved with PHPExcel which allows you to set the width for each column explicitly.