phpexcel

PHPExcel create/style/save PDF Documentation

浪尽此生 提交于 2019-12-23 19:14:45
问题 I'm using the PHPExcel library in a couple of project and love the functionality it provides. Currently I needed to save as a PDF and found that PHPExcel can do this but I'm finding it rather hard to track down some examples or documentation on the process. Here are the links I have found: http://phpexcel.codeplex.com/wikipage?title=News%20archive http://www.devshed.com/c/a/PHP/PHP-Excel-Working-with-Workbook-and-PDF-Files/1/ Follow up question: I need the PDF to look and function as a form,

PHPExcel: Coloring the cells?

白昼怎懂夜的黑 提交于 2019-12-23 18:48:27
问题 I'm using the PHPExcel to generate some sheets on my server. More or less it everything works fine, but, when I try to color some rows (every second row, so the list would be easily readable) I get funny thing: the row is colored ok, but only on cells that are not filled with data. The cells that are filled with data remain white. Here's code I use $ind = ($ind + 1) % 2; if($ind == 1) { $style_header = array( 'fill' => array( 'type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb'=>

Add chart on phpoffice/phpword

a 夏天 提交于 2019-12-23 18:13:42
问题 I know how to add charts on PHPExcel, but I also need to insert charts on a docx file. Is it possible to manipulate charts with phpoffice/phpword? If it's not possible, do you know a good library for the job? 回答1: It's not actually possible to add chart in a PHPWord Document. But the feature is in the pipe (follow this ticket #123). But you can use of one of some libraries used (at the moment and in the future) by PHPExcel : PHP Charting Libraries . Actually, PHPExcel just use JpGraph for

Get the cell background color in PhpExcel

回眸只為那壹抹淺笑 提交于 2019-12-23 14:03:05
问题 I'm using Excel5 in my project. I have already tried the following codes: $objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->getARGB(); and $objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getEndColor()->getARGB(); but these codes are returning wrong color. The getStartColor() always returning FFFFFFFF and FF000000 for getEndColor() instead of red. I don't know what am missing. Can any one help me in figuring this out? 回答1: setReadDataOnly(TRUE) means read

Getting the Name of a Column from the row and column indexes in PHPExcel

僤鯓⒐⒋嵵緔 提交于 2019-12-23 08:10:08
问题 I want to know if it is possible to get the name of a column from the row and column indexes. i.e I want to have a function that would return the name of a column by passing the row index and the column index e.g let's say the name of my function is getColumnName. If I type getColumnName(1,8), I want it to return B8 for me. 回答1: Take a look at the PHPExcel_Cell::stringFromColumnIndex() method. This accepts a numeric argument, e.g. 1 or 255, and will return the corresponding column letter, e.g

PHPExcel conditional formatting not quite right

耗尽温柔 提交于 2019-12-23 05:44:05
问题 I'm trying to add a border to the bottom of all cells in every row after row 2 that satisfies this condition: $objConditional1 = new PHPExcel_Style_Conditional(); $objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_EXPRESSION) ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_EQUAL) ->addCondition('AND((B2<>B3),B2<>"")'); $objConditional1->getStyle()->getBorders()->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN); $conditionalStyles = $sheet->getStyle(

PHPExcel protect chart from drag and drop, and cut

扶醉桌前 提交于 2019-12-23 04:08:30
问题 I used PHPExcel to generate chart and i done it, also i have protected (read only) the file. But now i want to avoid from dragging of chart and also the cut option should be disabled or user should not be able to cut the chart. For any help thanks. 回答1: This code protects all objects in workbook - including charts: $workbook->getActiveSheet()->getProtection()->setObjects(true); Tested on PHPExcel 1.8.0. 来源: https://stackoverflow.com/questions/23578608/phpexcel-protect-chart-from-drag-and-drop

PHP Append to Excel file

百般思念 提交于 2019-12-23 03:47:54
问题 I'm having a little bit of trouble trying to append data to an Excel file from PHP. I'm using PHPExcel and the code is below. The problem is: When the files were small enough it was working great. But then the files started to get bigger and I started to get the Allowed memory size exhausted error. So, i though that instead of writing the file from scratch everytime I'd get only the new data and append to the file. But it's not writing to the file for some reason. Does anyone have an idea?

Hardcoding headers to excel file using PHP while dynamically querying SQL

折月煮酒 提交于 2019-12-23 03:22:26
问题 I have this PHPExcel code: /** Error reporting */ error_reporting(E_ALL); date_default_timezone_set('Europe/London'); /** Include PHPExcel */ require_once '../Classes/PHPExcel.php'; $objPHPExcel = new PHPExcel(); //$objPHPExcel->setActiveSheetIndex(0) // ->setCellValue('A1', 'Hello') // ->setCellValue('A2', 'world!') $row = 2; while($row_data = mysql_fetch_assoc($result)) { $col = 1; foreach($row_data as $key=>$value) { $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($col, $row,

PHPExcel style problem

我与影子孤独终老i 提交于 2019-12-22 11:12:11
问题 $objPHPExcel->getActiveSheet()->SetCellValue('A1', 'Name'); 1.How I set this to bold? 2.How I set the width(I will have some dinamic text in the cells!)? I have read the documentation, but I haven't found any solutions! 回答1: Bold: $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true); Width: $objPHPExcel->getActiveSheet()->getCell('A1')->setWidth(15); Not tested though. 回答2: $col zero 0 based $worksheet->getColumnDimensionByColumn($col)->setWidth($width); Hi 2009 来源: https: