phpexcel

PHPExcel How to set a date in cell

僤鯓⒐⒋嵵緔 提交于 2019-12-19 20:37:41
问题 I need to put a date in a cell, when I take a look to its format it looks like *14/03/01. The value I put is a simple string and for that reason when I get the calculated values ignores the date I entered because it compares in a calendar (well, a column with all the dates of the actual year) the date that I entered with the dates to set a proper value corresponding the date entered. Is there a way to put the format that Excel expects? 回答1: MS Excel uses a timestamp value for dates, and then

PHPExcel How to set a date in cell

折月煮酒 提交于 2019-12-19 20:37:14
问题 I need to put a date in a cell, when I take a look to its format it looks like *14/03/01. The value I put is a simple string and for that reason when I get the calculated values ignores the date I entered because it compares in a calendar (well, a column with all the dates of the actual year) the date that I entered with the dates to set a proper value corresponding the date entered. Is there a way to put the format that Excel expects? 回答1: MS Excel uses a timestamp value for dates, and then

Prevent PHPExcel to calculate values when writing to file

你离开我真会死。 提交于 2019-12-19 17:48:48
问题 When writing my data in an Excel file with class PHPExcel. This is happening when the writer works, not when adding data to the cells $this->sheet->setCellValue() Fatal error: Uncaught exception 'PHPExcel_Calculation_Exception' with message 'Adressen!AF20955 -> Formula Error: Unexpected operator '>'' in \Cell.php:300 Stack trace: #0 \PHPExcel\Worksheet.php(754): PHPExcel_Cell->getCalculatedValue() #1 \PHPExcel\Writer\Excel2007\Worksheet.php(373): PHPExcel_Worksheet->calculateColumnWidths() #2

PHPExcel Sumif and Skip

ε祈祈猫儿з 提交于 2019-12-19 12:04:40
问题 I just want to ask if there's a function in excel/phpexcel that can SUM a range of cells but skip to add every one cell. Ex. Range is A1:G1 and it will only sum A1+C1+E1+G1 skipping every 1 cell. Or how can I do that? Please take note that range is dynamic. It could be a1:g1 or further or less. 回答1: Build the formula dynamically in your PHP script: $startCell = 'A'; $endCell = 'H'; $row = 1; $formula = '=' . $startCell . $row; while ($startCell++ != $endCell && $startCell++ != $endCell) {

PHPExcel CSV to XLSX

谁都会走 提交于 2019-12-19 10:42:51
问题 I have a problem converting file feom CSV to XLSX format: Index.php <?php if (!isset($_FILES["file"])) { ?> <html> <body> <h1>Convert CSV to XLSX</h1> <form action="index.php" method="post" enctype="multipart/form-data"> <input type="file" name="file"/> <input type="submit"/> </form> </body> </html> <?php exit; } //obtain PHPExcel from http://phpexcel.codeplex.com require_once('Classes\PHPExcel.php'); require_once('CSVToExcelConverter.php'); if ($_FILES["file"]["error"] > 0) { echo "Error: "

How can i make bullets list in PHPExcel

霸气de小男生 提交于 2019-12-19 10:05:29
问题 I was trying to convert the html tags from php to excel using PHPExcel , everything is going alright except that I can't find how to make bulletted list. is this feature exist in PHPExcel? i already scan some of the documentary of PHPExcel but i can't find anything about bullets. i want to place the bulletted inside one cell Thank you 回答1: You simply want a string containing newline characters, and then to set the cell to wrap $value = "• Foo\n• Bar"; $objPHPExcel->getActiveSheet() -

PHPExcel taking an extremely long time to read Excel file

随声附和 提交于 2019-12-19 09:25:26
问题 I'm using PHPExcel 1.7.8, PHP 5.4.14, Windows 7, and an Excel 2007 spreadsheet. The spreadsheet consists of 750 rows, columns A through BW, and is about 600KB in size. This is my code for opening the spreadsheet--pretty standard: //Include PHPExcel_IOFactory include 'PHPExcel/IOFactory.php'; include 'PHPExcel.php'; $inputFileName = 'C:\xls\lspimport\GetLSP1.xlsx'; // Read your Excel workbook try { $inputFileType = PHPExcel_IOFactory::identify($inputFileName); $objReader = PHPExcel_IOFactory:

PHPExcel drawing chart cause unreadable content and chart removed

自古美人都是妖i 提交于 2019-12-19 04:59:15
问题 I used PHPExcel to generate chart all things are correct but sometimes when i open the file it shows message indicate unreadable content when i click on yes button for repair is removed. Bellow is my code. $workbook = new PHPExcel(); for($sh = 0; $sh <= 2; $sh++) { if($sh == 0) { $sheet = $workbook->createSheet($sh); $sheet = $workbook->setActiveSheetIndex($sh); $workbook->getActiveSheet()->setTitle($this->lang->line('co_repBased_pos')); $sheet_name = $sheet->getTitle(); } elseif($sh == 1) {

Using PHPExcel in CakePHP

白昼怎懂夜的黑 提交于 2019-12-19 04:39:09
问题 Background Well I tried to ask this question, but it got closed down faster than a horrible security leak. I want to write an excel file using PEAR's Spreadsheet Excel Writer. I Google'd endlessly for a easy way to do this, and finally found a helper that might actually do the job. But it uses PHPExcel, so I'll have to rewrite that script, which is the least of my worries. I just don't want to start now, and then still not be able to get it working. I have also downloaded PHPExcel as required

PHPExcel - Formatting gets lost when editing from code

て烟熏妆下的殇ゞ 提交于 2019-12-19 04:04:10
问题 I'm playing around with an PHP - MS Excel integration these days. My task is to open an existing spreadsheet, add some data and save the filled spreadsheet as a new file. Basically sort of a template filling engine, eventhough xlsx files are used as templates. I looked into PHPExcel which seems to be fairly nice framework. In order to implement a proof of concept I did the following (reduced to the minimum required to illustrate what I need to do): $objReader = PHPExcel_IOFactory: