Hi Experts,
i want to develop a page in which, when i click Export, an excel should open up.
I created a application, and i am able to open a Excel sheet when i click Export.
In the Excel First row contain headings(Name, Address, City)
I want the City to be a dropdown. I have googling for last 2 days, till i didnt find a solution.
The city should be a dropdown, listing cities in the database.
Can any one help me????
Thanks In Advance,
Rabeeh
Export to excel in php
Moderator: General Moderators
Re: Export to excel in php
PHP supports exporting a CSV file using a header that indicates that the associated application should be Microsoft Excel, but I don't know of any way to enable any special features of Excel, like dropdown lists. You can do that as HTML, but as far as I know, not in a CSV file, which is basically just a text file.
Re: Export to excel in php
You may have more luck with the COM library (this is only available on a Windows server - possibly through Wine, I've never tried). The COM library let's you create Microsoft Office documents dynamically, including (but not exclusively) Excel documents.
As for creating your drop-down boxes I'm not sure, you'll have to read the COM documentation. Creating a CSV would be your easiest option but you're limited to text-only.
As for creating your drop-down boxes I'm not sure, you'll have to read the COM documentation. Creating a CSV would be your easiest option but you're limited to text-only.
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: Export to excel in php
Take a look at a library such as PHPExcel which allows you to create genuine Excel workbooks (rather than simple CSV files) that support the Excel autofilter feature