Hello, Recently I am using phpexcel and afer many tries I wasn't able to find out how to make a document with a image in its header. Here is a simplified code that I am using. Can someone helps me with this issue?! <?php require_once 'PHPExcel.php'; $objPHPExcel = new PHPExcel(); $objDrawing = new PHPExcel_Worksheet_HeaderFooterDrawing(); $objDrawing->setPath('header.jpg'); $objPHPExcel->getActiveSheet()->getHeaderFooter()->addImage($objDrawing, PHPExcel_Worksheet_HeaderFooter::IMAGE_HEADER_RIGHT); $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader("&C&G"); $objPHPExcel->setActiveSheetIndex(0)->setCellValueExplicit('A1', 'CODICE PRATICA'); $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); $objWriter->save('test.xlsx'); ?>

Member Avatar
Member Avatar
+0 forum 3

I cannot find anything in phpExcel documentation. What I would like is to end up with an associative array with keys from the first row in the excel worksheet. It's something that can be done of course, but is there a native method?

Member Avatar
Member Avatar
+0 forum 4

Hi Everyone! Can anybody point me to the right direction or check what am i doing wrong. Im trying to export data from php to excel using phpexcel( which is working fine if im am only getting 1 specific record). but when i tried adding a loop to create a workbook im having a problem. the data does not match the actual record from DB this is the script Currently editing: /home/msicph/public_html/sedaatria/demo/toexcel/genexcel.php Encoding: Reopen Switch to Code Editor Close Save <?php error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />'); date_default_timezone_set('Europe/London'); /** PHPExcel_IOFactory */ require_once dirname(__FILE__) …

Member Avatar
Member Avatar
+0 forum 12

Hello, I am working on PHPExcel But in there calculation 0.625 we want to coming by dynamical from database. bellow brief description. They all used to be 62.5% of the delivery fees as seen below: `setCellValue('G'.($start_row+2), (($total_delivery/11)*10)*0.625);` all the drivers can have different percentages assigned to them and we need the driver report to show the correct percentage in the calculations. For Going on Driver_report.php [code in line: 394] <?php /** * PHPExcel * * Copyright (C) 2006 - 2013 PHPExcel * * This library is free software; you can redistribute it and/or * modify it under the terms of …

Member Avatar
+0 forum 0

I'm not sure I undestand the second dimension of the three dimensional array that I created in `$rowData`. `test.xlsx` contains 3 row and 2 columns of string values. Also `count($rowData)` returns 12, not 6. <?php // Include PHPExcel_IOFactory include '../PHPExcel/Classes/PHPExcel/IOFactory.php'; $inputFileName = 'c:\DOCS\test.xlsx'; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory::createReader($inputFileType); $objPHPExcel = $objReader->load($inputFileName); } catch(Exception $e) { die('Error loading file "'.pathinfo($inputFileName,PATHINFO_BASENAME).'": '.$e->getMessage()); } // Get worksheet dimensions $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); echo $highestRow . "<br/>"; $highestColumn = $sheet->getHighestColumn(); echo $highestColumn. "<br/>"; // Loop through each row of the worksheet in turn for …

Member Avatar
Member Avatar
+0 forum 2

Been trying to loop through worksheets in an excel document. And remove "," in columns. Then save result in same excel document. <?php include'../Classes/PHPExcel.php'; include'../Classes/PHPExcel/IOFactory.php'; $objReader = PHPExcel_IOFactory::createReader('Excel2007'); $objReader->setReadDataOnly(false); //$xlsxfiles=$_SESSION['file']; //echo $xlsxfiles; $objPHPExcel = $objReader->load('../upload/Test_0.xlsx'); $num=$objPHPExcel->getSheetCount() ; $sheetnames=$objPHPExcel->getSheetNames() ; $objWorksheet = $objPHPExcel->getActiveSheet(); $highestRow = $objWorksheet->getHighestRow(); $sheetnum=$num-1; for($sl=0;$sl<$sheetnum;$sl++) { for($cl=0;$cl<$highestRow;$cl++){ $clean= $objPHPExcel->setActiveSheetIndex($sl) ->getCell('C'.$cl); $cleandone=str_replace(',',' ',$clean); $objWorksheet->setCellValue('C'.$cl,$cleandone); $clcolvalD=$objWorksheet->getCell('D'.$cl); $clcolvalD=str_replace(',',' ',$clcolvalD); $objWorksheet->setCellValue('D'.$cl,$clcolvalD); $clcolvalE=$objWorksheet->getCell('E'.$cl); $clcolvalE=str_replace(',',' ',$clcolvalE); $objWorksheet->setCellValue('E'.$cl,$clcolvalE); $clcolvalF=$objWorksheet->getCell('F'.$cl); $clcolvalF=str_replace(',',' ',$clcolvalF); $objWorksheet->setCellValue('F'.$cl,$clcolvalF); $clcolvalG=$objWorksheet->getCell('G'.$cl); $clcolvalG=str_replace(',',' ',$clcolvalG); $objWorksheet->setCellValue('G'.$cl,$clcolvalG); $clcolvalH=$objWorksheet->getCell('H'.$cl); $clcolvalH=str_replace(',',' ',$clcolvalH); $objWorksheet->setCellValue('H'.$cl,$clcolvalH); $clcolvalI=$objWorksheet->getCell('I'.$cl); $clcolvalI=str_replace(',',' ',$clcolvalI); $objWorksheet->setCellValue('I'.$cl,$clcolvalI); $clcolvalJ=$objWorksheet->getCell('J'.$cl); $clcolvalJ=str_replace(',',' ',$clcolvalJ); $objWorksheet->setCellValue('J'.$cl,$clcolvalJ); $clcolvalK=$objWorksheet->getCell('K'.$cl); $clcolvalK=str_replace(',',' ',$clcolvalK); $objWorksheet->setCellValue('K'.$cl,$clcolvalK); $clcolvalL=$objWorksheet->getCell('L'.$cl); $clcolvalL=str_replace(',',' ',$clcolvalL); $objWorksheet->setCellValue('L'.$cl,$clcolvalL); $clcolvalM=$objWorksheet->getCell('M'.$cl); $clcolvalM=str_replace(',',' ',$clcolvalM); $objWorksheet->setCellValue('M'.$cl,$clcolvalM); $clcolvalN=$objWorksheet->getCell('N'.$cl); $clcolvalN=str_replace(',',' ',$clcolvalN); $objWorksheet->setCellValue('N'.$cl,$clcolvalN); } …

Member Avatar
Member Avatar
+0 forum 1

Hi, I need to get a cell values and to print that cell values in another cell using PHPExcel? For Ex: A12:5 . I need this same value "5" to be printed in the cell B12. thanks for your help.

Member Avatar
Member Avatar
+0 forum 3

The End.