Save the file as a "excelsample.php tutorial" in the Htdocs folder. Open the browser and enter in the Address bar:
http://www.jzread.com/excelsample.php
The current version of Excel is displayed on the page, and the workbook named Php_excel_test.xls is created and the test is entered in the worksheet Sheet1 cell A1. Open the workbook Php_excel_test.xls and you will see that you have entered the test in cell A1. Note: In order to prevent garbled, the code format has been set up and the file is saved in gb2312 format.
<?php Specify page encoding to prevent the occurrence of garbled Chinese Header (' content-type:text/html charset=gb2312 ');
Start Excel $ms _excel=new COM ("Excel.Application") or Die ("Cannot open Excel application");
Display the current version of Excel in a Web page echo "Excel version: {$ms _excel->version}n";
Create a new workbook $ms _excel->application->workbooks->add () or Die ("Cannot add a new workbook");
Enter text in cell A1 in the worksheet Sheet1 of the workbook $ms _excel->worksheets ("Sheet1")->range ("A1")->value= "test";
Save the workbook, if you do not specify a path, the default is saved in my document $ms _excel->workbooks (1)->saveas ("Php_excel_test.xls");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.