PHPExcel导出问题
在利用PHPExcel类做导出时出现了几个错误 。。求大神指导
第一个问题:Warning: Set the ini directive 'precision' without permission in Classes/PHPExcel/Calculation.php on line 1697
第二个问题:Fatal error: Class 'XMLWriter' not found in Classes/PHPExcel/Shared/XMLWriter.php on line 44
回复讨论(解决方案)
贴出你的相关代码
上回的问题解决了,现在又出现了点新问题。
//引入所需的文件
ob_end_clean();
header("Content-type: text/html;charset=utf-8");
require_once '../../Classes/PHPExcel.php';
require_once '../../Classes/PHPExcel/Writer/Excel2007.php';
require_once '../../Classes/PHPExcel/Writer/Excel5.php';
include_once '../../Classes/PHPExcel/IOFactory.php';
//创建一个处理对象的实例
$objExcel = new PHPExcel();
//设置基本属性
$objExcel->getProperties()->setCreator("Kemper_Diao");
$objExcel->getProperties()->setLastModifiedBy("Kemper_Diao");
$objExcel->getProperties()->setTitle("Office 2007 XLSX");
$objExcel->getProperties()->setSubject("Office 2007 XLSX");
$objExcel->getProperties()->setDescription("Document for Office 2007 XLSX, generated using PHP classes.");
$objExcel->getProperties()->setKeywords("office php");
$objExcel->getProperties()->setCategory("Excel2007 Output");
//开始处理数据,索引从0开始
$objExcel->setActiveSheetIndex(0);
//设置表头
$objExcel->getActiveSheet()->mergeCells('A1:K1');
$objExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$objExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
$objExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(16);
$objExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objExcel->getActiveSheet()->setCellValue('A1',"供应商Excel导出表");
//字段名
$objExcel->getActiveSheet()->setCellValue('A2', "ID");
$objExcel->getActiveSheet()->setCellValue('B2', "供应商名称");
$objExcel->getActiveSheet()->setCellValue('C2', "投标项目");
$objExcel->getActiveSheet()->setCellValue('D2', "供应品牌");
$objExcel->getActiveSheet()->setCellValue('E2', "供应商地址");
$objExcel->getActiveSheet()->setCellValue('F2', "供应商资质");
$objExcel->getActiveSheet()->setCellValue('G2', "联系人");
$objExcel->getActiveSheet()->setCellValue('H2', "联系电话");
$objExcel->getActiveSheet()->setCellValue('I2', "其它联系方式");
$objExcel->getActiveSheet()->setCellValue('J2', "合作记录");
$objExcel->getActiveSheet()->setCellValue('K2', "最近业绩");
//供应商导出传递参数操作
$projectID = $_POST['projectid'];
//数据库操作
try{
$pdo_db = new PDO("mysql:host=localhost;dbname=test","RASuser","remote");
$pdo_db->query("set names gbk;");
$result = $pdo_db->query("SELECT * FROM table_suppliercheck WHERE ProjectID=".$projectID);
}catch(PDOException $e){
exit("Connection error:".$e->getMessage());
}
$i = 3;
foreach($result as $row){
//写入内容
$objExcel->getActiveSheet()->setCellValue('A'.$i, iconv("gbk","utf-8","$row[ID]"));
$objExcel->getActiveSheet()->setCellValue('B'.$i, iconv("gbk","utf-8","$row[SupplierName]"));
$objExcel->getActiveSheet()->setCellValue('C'.$i, iconv("gbk","utf-8","$row[ProjectName]"));
$objExcel->getActiveSheet()->setCellValue('D'.$i, iconv("gbk","utf-8","$row[SupplierBrand]"));
$objExcel->getActiveSheet()->setCellValue('E'.$i, iconv("gbk","utf-8","$row[SupplierAddress]"));
$objExcel->getActiveSheet()->setCellValue('F'.$i, iconv("gbk","utf-8","$row[SupplierAptitude]"));
$objExcel->getActiveSheet()->setCellValue('G'.$i, iconv("gbk","utf-8","$row[LinkMan]"));
$objExcel->getActiveSheet()->setCellValue('H'.$i, iconv("gbk","utf-8","$row[LinkPhone]"));
$objExcel->getActiveSheet()->setCellValue('I'.$i, iconv("gbk","utf-8","$row[LinkOther]"));
$objExcel->getActiveSheet()->setCellValue('J'.$i, iconv("gbk","utf-8","$row[LastResult]"));
$objExcel->getActiveSheet()->setCellValue('K'.$i, iconv("gbk","utf-8","$row[CooperationRecord]"));
$i++;
}
//重命名表名
$objExcel->getActiveSheet()->setTitle("供应商");
$objExcel->setActiveSheetIndex(0);
//找出项目名作为表名
$name = $pdo_db->query("SELECT TenderTitle FROM table_tendermessage WHERE ID=".$projectID)->fetch();
$filename = $name['TenderTitle'];
//保存为Excel2003
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename='.$filename.'.xls');
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>
这次提示什么OLE.PHP文件出错是什么回事?
这个问题也解决了,原来是时区的设置问题啊。
网上看了下三种时区设置方法:
1.在页头使用date_default_timezone_set()设置 date_default_timezone_set('PRC'); //东八时区 echo date('Y-m-d H:i:s');
2.在页头使用 ini_set('date.timezone','Asia/Chongqing');
3.修改php.ini。打开php5.ini查找date.timezone 去掉前面的分号修改成为:date.timezone =PRC
第二个问题:Fatal error: Class 'XMLWriter' not found in Classes/PHPExcel/Shared/XMLWriter.php on line 44
第二个问题:Fatal error: Class 'XMLWriter' not found in Classes/PHPExcel/Shared/XMLWriter.php on line 44
哥们 ,,,你这的问题怎么解决的说下哈,,,,

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Listening to music is a very common thing, I believe many friends will do it no matter where they are. What software do you usually use to listen to music? Do you use QQ Music like me? I currently use QQ Music to listen to songs, and it can be used not only on mobile phones, but also on Mac computers. In addition to listening to songs online, we can also download our favorite songs from QQ Music to the computer. However, the songs downloaded from QQ Music for Mac are not in the format we need. What we need is music in MP3 format. So how to export the songs downloaded from QQ Music for Mac to MP3 format? How to export and convert songs downloaded from QQ Music for Mac to MP3 format? If you want to export and convert songs downloaded from QQ Music for Mac to MP

With the continuous rise of social media, Douyin, as a popular short video platform, has attracted a large number of users. On Douyin, users can not only show their lives but also interact with other users. In this interaction, emoticons have gradually become an important way for users to express their emotions. 1. How to get Douyin private message emoticons on WeChat? First of all, to get private message emoticons on the Douyin platform, you need to log in to your Douyin account, then browse and select the emoticons you like. You can choose to send them to friends or collect them yourself. After receiving the emoticon package on Douyin, you can long press the emoticon package through the private message interface, and then select the "Add to Emoticon" function. In this way, you can add this emoticon package to Douyin’s emoticon library. 3. Next, we need to add the words in the Douyin emoticon library

xmind is a very practical mind mapping software. It is a map form made using people's thinking and inspiration. After we create the xmind file, we usually convert it into a pdf file format to facilitate everyone's dissemination and use. Then How to export xmind files to pdf files? Below are the specific steps for your reference. 1. First, let’s demonstrate how to export the mind map to a PDF document. Select the [File]-[Export] function button. 2. Select [PDF document] in the newly appeared interface and click the [Next] button. 3. Select settings in the export interface: paper size, orientation, resolution and document storage location. After completing the settings, click the [Finish] button. 4. If you click the [Finish] button

1. First, open the design plan to be processed in Kujiale and click on the construction drawings under the drawing list above. 2. Then click to select the full-color floor plan. 3. Then hide the unnecessary furniture in the drawing, leaving only the furniture that needs to be exported. 4. Finally, click Download.

Call recording in iPhone is often underestimated and is one of the most critical features of iPhone. With its simplicity, this feature is of vital importance and can provide important insights about the calls made or received on the device. Whether for work purposes or legal proceedings, the ability to access call records can prove invaluable. In simple terms, call history refers to the entries created on your iPhone whenever you make or receive a call. These logs contain key information, including the contact's name (or number if not saved as a contact), timestamp, duration, and call status (dialed, missed, or not answered). They are a concise record of your communication history. Call history includes call history strips stored on your iPhone

How does DingTalk export attendance data? You can take attendance data everywhere in DingTalk, but most users don’t know how to take attendance data everywhere. Next is a graphic tutorial on how to export attendance data from DingTalk brought to users by Peiwei. If you are interested, Players come and take a look! How to export attendance data on DingTalk 1. First open the DingTalk APP and enter the main page, and click the [Workbench] icon at the bottom; 2. Then on the workbench page, click the [Attendance Punch-in] button; 3. Then use the function shown in the figure below page, click on the [Statistics] function at the bottom to enter the special area; 4. Then on the statistics page, click on the [Export Report] function in the upper left corner; 5. Finally, on the attendance report page, click the blue [Export Report] at the bottom to complete.

Complete Guide: How to Process Excel Files Using PHP Extension PHPExcel Introduction: Excel files are often used as a common format for data storage and exchange when processing large amounts of data and statistical analysis. Using the PHP extension PHPExcel, we can easily read, write and modify Excel files to effectively process Excel data. This article will introduce how to use the PHP extension PHPExcel to process Excel files and provide code examples. 1. Install PHPExc

With the advent of the digital age, data has become the most important part of our daily lives and work, and Excel files have become one of the important tools for data processing. I believe that many PHP developers will often encounter the use of Excel files for data processing and operations at work. This article will introduce you to the methods and precautions for using the PHPExcel library to process Excel files. What is PHPExcel? PHPExcel is a PHP class
