/    Sign up×
Community /Pin to ProfileBookmark

Create an Excel File as a workbook type not a Web Page type

Dear developers,
i want to ask about creating an excel file as workbook type using PHP. as we know that PHP is able to generate an excel file using script like :

[code=php]$file = “reseller_report_detail.xls”;
header(“Content-type: application/msexcel”);
header(“Content-Disposition: attachment; filename=”.$file);[/code]

. But then the file that we generate is generated as a web page type not a workbook type eventhough is use [B].xls[/B] as file extension. could you tell me how to directly generate an excel file as a workbook type so i don’t have to open the file an change it into a workbook type because some of my apllication don’t recognize Web Page type.

Thank you very much for your answer ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogFeb 09.2009 — The simplest thing is to output it as a .csv file instead of .xls and use [url=http://www.php.net/fputcsv]fputcsv[/url](). If you want a true .xls file, you will have to do quite a bit more work to generate the requisite file format. Or if using a current version of Excel that supports the newer XML format, you could try something like [url=http://sourceforge.net/projects/excelwriterxml/]this[/url].
Copy linkTweet thisAlerts:
@GUIRFeb 10.2009 — Hi,

I recently used PHPExcel package, it is really great.

Not only formatting, you can pass excel formulas, conditional formatting almost everything thing you do with desktop excel.

Actually I got good marks for my app becuase of PHPExcel . ? May be you too.

Think that may help you instead coding excel generation from the scratch.

Thanks and Best Regards
×

Success!

Help @baltazhor200401 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...