10
I Use This!
Inactive

News

Analyzed 1 day ago. based on code collected 1 day ago.
Posted almost 9 years ago by Manish5041
Hi, I am trying to add 0 in the sheet but its not getting add.$objPHPExcel->getActiveSheet()->setCellValueExplicit('A1', '0029' ... [More] , PHPExcel_Cell_DataType::TYPE_STRING);$objPHPExcel->getActiveSheet()->getStyle('A3')->getNumberFormat()->setFormatCode('0000');I have tried this both above code but its not working for me.So can you please help me out with this?Thanks,Manish Soni [Less]
Posted almost 9 years ago by MrGrassy
The getLibXmlLoaderOptions() function is use $options variable.It is wrong because it is not defined.The class have a variable for this: self::$_libXmlLoaderOptions.I change my code and it is working good.
Posted almost 9 years ago by Midlothainadair
I figured out part of it. I have a white space character of some kind at the beginning of the file, that is what is causing the garbage printing. I was able to remove some of it, all that I could find actually, but it was still printing the garbage. ... [More] I ended up changing the end of my code to account for it like this: $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel); ob_clean(); $objWriter->save('php://output'); This has cleared up the garbage printing, but I still can't figure out where else I need to look for the white space characters or if that is even the problem any long [Less]
Posted almost 9 years ago by Midlothainadair
I am trying to use PHPExcel to export reports. I have it setup so that it will pull from my MSSQL DB just fine, but it doesn't add any of the data, just garbage. I've commented out the parts where it should be adding the data and it is still just ... [More] posting garbage into the file. I am doing this using PHP, so I don't know what's going on. I am not even able to open the file as is I have to change the extension from .xlsx to .xls. then I can open it. When I go to the file's info page, none of the set values from the PHP file are set in the Excel file. I have this: $objPHPExcel->getProperties()->setCreator("Mike in IT") ->setLastModifiedBy("Mike in IT") ->setTitle($TableName) ->setSubject($TableName) ->setDescription("Report for " .$TableName. " using PHPExcel, generated using PHP classes.") ->setKeywords("office PHPExcel php " . $TableName) ->setCategory("Report Export File"); Which should set the info properties, but isn't. Here's the whole file that I'm using for creating the Excel sheet, this is a modification of the 01simple-download-xlsx.php query($hsql); $rHeadings = $getHeadings->fetchALL(PDO::FETCH_ASSOC); $CountHeadings = count($rHeadings); //Count how many columns that there will be $tsqlHeadings = ''; $ColumnHeader = array(); for ($row = 0; $row < $CountHeadings; $row++) { $headings[$row] = $rHeadings[$row]["Headings"]; //fill the array of column headings for use in creating the DataTable } foreach($headings as $index => $columnName) { $ColumnHeader[] = array('db'=>$columnName,'dt'=>$index); //creates the array for creating the DataTable column headers when sent to the FilterSort.class } // Error reporting error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); if (PHP_SAPI == 'cli') die('This example should only be run from a Web Browser'); // Include PHPExcel require_once dirname(__FILE__) . './Classes/PHPExcel.php'; // Create new PHPExcel object $objPHPExcel = new PHPExcel(); // Set document properties $objPHPExcel->getProperties()->setCreator("Mke in IT") ->setLastModifiedBy("Mke in IT") ->setTitle($TableName) ->setSubject($TableName) ->setDescription("Report for " .$TableName. " using PHPExcel, generated using PHP classes.") ->setKeywords("office PHPExcel php " . $TableName) ->setCategory("Report Export File"); // Add some data $ColumnArray = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AW','AX','AY','AZ'); $HeadingArray = $headings; $primaryKey = 'id'; $table = $SQLTableName; $request = $_POST; $dataArray = array(); require('FilterSort.class.php'); $dataArraystr = json_encode(FilterSort::complex($request,$sqlConnect,$table,$primaryKey,$ColumnHeader)); $dataArraystr = str_replace('{"draw":0,"recordsTotal":76,"recordsFiltered":76,"data":[["','","',$dataArraystr); $dataArraystr = str_replace('\r','',$dataArraystr); $dataArraystr = str_replace('\n','',$dataArraystr); $dataArraystr = str_replace('\t','',$dataArraystr); $dataArraystr = str_replace('\"','',$dataArraystr); $dataArraystr = str_replace('"]]}','',$dataArraystr); $dataArraystr = str_replace('<\/div>','',$dataArraystr); $dataArraystr = str_replace('Format([OPEN_FOR_SALES_ACT],','Format([OPEN_FOR_SALES_ACT],1)',$dataArraystr); $dataArraystr = str_replace('"],["','::',$dataArraystr); $dataArraystr = explode('::',$dataArraystr); foreach($dataArraystr as $ArrayStr) { $dataArray[] = explode('","',$ArrayStr); } //$objPHPExcel->getActiveSheet()->fromArray($dataArray, NULL, 'A2'); //$objPHPExcel->getActiveSheet()->fromArray($HeadingArray, NULL, 'A1'); //$objPHPExcel->getActiveSheet()->fromArray($_POST,NULL,'G2'); //$objPHPExcel->getActiveSheet()->setCellValue('F2','POST'); $CountOfArray = count($HeadingArray); // Set title row bold $objPHPExcel->getActiveSheet()->getStyle('A1:' .$ColumnArray[$CountOfArray-1]. '1')->getFont()->setBold(true); // Set autofilter // Always include the complete filter range! // Excel does support setting only the caption // row, but that's not a best practise... $objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension()); // Rename worksheet $objPHPExcel->getActiveSheet()->setTitle('SimpleTest'); // Set active sheet index to the first sheet, so Excel opens this as the first sheet $objPHPExcel->setActiveSheetIndex(0); // Redirect output to a client’s web browser (Excel2007) header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); header('Content-Disposition: attachment;filename="ExportAllToExcelTest.xlsx"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header ('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save('php://output'); ?> [Less]
Posted almost 9 years ago by Ahsun
You will find in the attachment the modified and added files to PHPExcel v1.7.8 to enable reading and writing macros, elements of customizing the Ribbon in Excel 2007.Signed macros are handled, "user" images of the Ribbon also . If this is of any ... [More] interest, some improvements can be made, for example the use of caching system to preserve the memory.Comments: ** Comment from web user: Ahsun ** What should we do if we have the latest PHPExcel version i.e 1.8 The Macros are not properly read and write in the 1.8 version. Can you please guide or upload the code compatible for this version Thanks [Less]
Posted almost 9 years ago by koeshiro
Rated 4 Stars (out of 5) - Problems with registr.
Posted almost 9 years ago by luxphp
I want to save a value in the excel but so that the cell is already saved as hour format. As text format gehts that is standard.
Posted about 9 years ago by zohaibshahzad
I am trying to load excel sheet (generated by other application) using phpexcel library, with following code -----------------------------$objReader = new PHPExcel_Reader_Excel2007();$objReader->setReadDataOnly(true);$objPHPExcel = ... [More] $objReader->load('callsheet.xlsx');//var_dump($objPHPExcel);$objPHPExcel->setActiveSheetIndex(0);$dataArray = $objPHPExcel->getActiveSheet()->toArray(null, true,true,true);var_dump($dataArray);-----------------------------But I got this error. Fatal error: Uncaught exception 'PHPExcel_Exception' with message 'You tried to set a sheet active by the out of bounds index: 0. The actual number of sheets is 0.' in E:\xampp\htdocs\podioexcel\Classes\PHPExcel.php:688 Stack trace: #0 E:\xampp\htdocs\podioexcel\test.php(18): PHPExcel->setActiveSheetIndex(0) #1 {main} thrown in E:\xampp\htdocs\podioexcel\Classes\PHPExcel.php on line 688One interesting thing. when I open same excel sheet and just save file without any change. Than this code work fine , but problem is that I,m not going to open file each time before to use it. Can you please help me to fix this issue. I,ve also attached excel sheet. [Less]
Posted about 9 years ago by walsh0959
I want let excel data into mysql. But I have problems when use phpexcel read excel 2003 file, the connection be suspend. But its success when read excel 2007 file. here is my code. the data will insert twice, and the connection would be stop. ... [More] Server os is win 2003 server. php vision is 5.2.6. thanks for answering. $objPHPExcel = PHPExcel_IOFactory::load($uploadfile); $objPHPExcel->setActiveSheetIndex(0); $sheet = $objPHPExcel->getActiveSheet(); $highestRow = $sheet->getHighestRow(); $highestColumn = $sheet->getHighestColumn(); for($j=2;$j<=$highestRow;$j++){ for($k='A';$k<=$highestColumn;$k++){ $str .= $objPHPExcel->getActiveSheet()->getCell("$k$j")->getValue().'\\'; } $strs = explode("\\",$str); $sql = "INSERT INTO net_mailuser(name,email,phone,cell,address,qa,ps,psname) VALUES('$strs[0]','$strs[1]','$strs[2]','$strs[3]','$strs[4]','$strs[5]','$strs[6]','$strs[7]');"; if(!mysql_query($sql)){ return false; } $str = ""; [Less]
Posted about 9 years ago by madonko88
PhpExcel is throwing an exception: Type: PHPExcel_Reader_ExceptionMessage: ZipArchive library is not enabledBut i checked on the extensions and it is installed, what could be the problem.