phpexcel

can't read and write xlsx file php

时光总嘲笑我的痴心妄想 提交于 2019-12-10 12:27:59
问题 this is my code i want to attach this file and send it and the values are numerical variables that in excel file i use them to drow a chart it dosen't work at all , my boss is mad at me , Help let me explain more . i have to attach an excel file {which contains 4 numbers that are a test result and draw a chart } I've done the test i have the result, i have done sending with attachment but i can't make the file . require_once '../Classes/PHPExcel.php'; $fileType = 'Excel2007'; $fileName =

PHPExcel下载多个sheet页的表格

三世轮回 提交于 2019-12-10 11:59:17
我的数据格式如下 具体代码: $expTitle = '伊利数据'; $xlsTitle = iconv('utf-8', 'gb2312', $expTitle); $fileName = $expTitle . date('_YmdHis');//表名 //实例化 $objPHPExcel = new \PHPExcel(); //设置 当前处于活动状态的SHEET 为PHPExcel自动创建的第一个SHEET foreach ($data as $key => $item) { if ($key !== 0) $objPHPExcel->createSheet(); $objPHPExcel->setactivesheetindex($key);//$key=2,代表第三个sheet页 $objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(24);//单元格宽度 $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setSize(12);//设置字体大小 $objPHPExcel->getActiveSheet()->getDefaultStyle()->getFont()->setName('宋体');//设置字体大小

How to modify excel file using PHPExcel in symfony2

人盡茶涼 提交于 2019-12-10 11:40:50
问题 In my project I use symfony2 PHPExcel wrapper https://github.com/liuggio/ExcelBundle With the example from the link above I can create new excel files. However this file has no style or markup at all. So I created a excel template where I want to input some data. I know how to load an excel file: $excelObj = $this->get('xls.load_xls2007') ->load($this->get('kernel') ->getRootDir() . '/../web/excel-template.xlsx'); //custom modifications on excel file Now I need to create a response. But in

PHPExcel output is garbled

南笙酒味 提交于 2019-12-10 11:22:31
问题 Im trying the simple examples -01simple.xls- that come with PHPExcel im getting garbled output. It (LibreOffice) wants to import the file it thinks the char set is Western Europe DOS/OS2-861.icelandic and the output is like this ╨╧αí▒ß ■ ╗ ╠╤B░=╝%r8X"1▄ÉCalibriα⌡ ╗ ╠╤*+éÇü┴âä&ffffffµ?'ffffffµ?(Φ?)Φ?í"dXX333333╙?333333╙?U}$ }$ }$ }$ ² ² ² ² ╢@gg Root Its probably something straightforward , but Ive no idea 回答1: try reupload phpexcel with the transfer type in the ftp set to auto. 回答2: Also make

PHPExcel right align image

瘦欲@ 提交于 2019-12-10 10:06:33
问题 I'm trying to align an image using PHPExcel but i can't because the image is overlaid above the worksheet. // Create new picture object $objDrawing = new PHPExcel_Worksheet_Drawing(); $objDrawing->setPath('my_img.jpg'); // Insert picture $objDrawing->setCoordinates('A1'); $objDrawing->setWorksheet($objPHPExcel->getActiveSheet()); // Style cell $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); The text align of A1 change

php操作excel表格的导入和导出

爱⌒轻易说出口 提交于 2019-12-10 04:48:27
前言:对于excel大家肯定熟悉不过了的,那么我们在日常的业务中应该是有对这些文件的导入导出操作的 类的下载:composer require phpoffice/phpexcel,其中Classes文件是核心文件 //导入excel文件<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>文件的读写</title> </head> <body> <form action="./importexcelserver.php" method="post" enctype="multipart/form-data"> 请选择文件:<input type="file" name="excel"> <br/> <input type="submit" value="上传"> </form> </body> </html> //excel导入的方法的后端代码 function import_One() { require "./Classes/PHPExcel/IOFactory.php"; $excelio=PHPExcel_IOFactory::load($_FILES['excel']['tmp_name']); //第一个参数是表单提交的name,第二个是临时名 $sheetcount=

getHighestColumn in xlsx not working

徘徊边缘 提交于 2019-12-10 04:26:51
问题 Have this code, using PHPExcel public function getHighestColumn() { return $this->objPHPExcel->setActiveSheetIndex(0)->getHighestColumn(); } public function getHighestRow() { return $this->objPHPExcel->setActiveSheetIndex(0)->getHighestRow(); } I have the same excel file saved in .xls and .xlsx It has 10 columns (From B to K), and 10 rows When I use getHighestColumn , in .xls I'm getting 'K' (correct), but in .xlsx I'm getting AMK (the last column in all excel worksheet) About the row, using

Copy and paste styles from one row to other

自古美人都是妖i 提交于 2019-12-10 03:45:31
问题 I'm using PHP Excel to create an Excel using a template Excel file. The problem is I have a datagrid and which I styled the header and first row in template. Here how it looks like: The top leftmost coordinate is C49. If I have 100 rows, I need to copy style of first row and paste it 100 times. Here is my code $cstart = 2; $rstart = 49; $count = 1; $input = $worksheet->getStyle(num2char($cstart) . $rstart); foreach ($b_data['rawData'] as $value) { $worksheet->setCellValueByColumnAndRow(

PHPExcel常用方法汇总(转载)

强颜欢笑 提交于 2019-12-10 03:40:52
PHPExcel常用方法汇总(转载) 博客分类: 脚本语言 Excel Office PHP 单元测试 Cache PHPExcel常用方法汇总 Posted by zeal on 2008-02-27 11:29 , 6027 characters | + 2 - 1 English 转载请保留本行原始出处声明信息 : http://www.zeali.net/entry/556 MaDe1nZEAL 标签 ( PHP ): php , excel PHPExcel 是相当强大的 MS Office Excel 文档生成类库,当需要输出比较复杂格式数据的时候,PHPExcel 是个不错的选择。不过其使用方法相对来说也就有些繁琐。列举以记之。 <script src="/plug-ins/SyntaxHighlighter/shCore.js"></script> view plain copy to clipboard print ? <? //设置PHPExcel类库的include path set_include_path( '.' . PATH_SEPARATOR . 'D:\Zeal\PHP_LIBS' . PATH_SEPARATOR . get_include_path()); /** * 以下是使用示例,对于以 //// 开头的行是不同的可选方式,请根据实际需要

Set rows to repeat at top when printing - PHPExcel

牧云@^-^@ 提交于 2019-12-10 00:24:59
问题 I need to put table head row to each printed page while printing a long data sheet(like this), but I failed to find any related setup in PHPExcel, could anyone faced the same problem help me out? 回答1: $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1,1); This worked for me 来源: https://stackoverflow.com/questions/35026930/set-rows-to-repeat-at-top-when-printing-phpexcel