phpspreadsheet

PhpSpreadsheet is corrupting files

感情迁移 提交于 2020-01-03 17:51:08
问题 I am using PhpSpreadsheet to modify an existing file and send it to the browser, but every time I download the file excel gives me the following error: We found a problem with some content in filename.xlsx. Do you want us to try and recover as much as we can? If you trust the source of this workbook, click Yes. I have stripped back everything to the following code. The template file that I am opening is a brand new excel file, with no edits made to it (to avoid the potential that the error

PHPSpreadsheet generates an error “Wrong number of arguments for INDEX() function: 5 given, between 1 and 4 expected”

醉酒当歌 提交于 2019-12-31 04:08:25
问题 I tried to enter the following code in my excel formula bar directly =INDEX($E$4:$E$132,AGGREGATE(15,6,ROW($1:$30) / ($J$4:$J$132=M4), COUNTIF($M$4:M4, M4))) and works perfectly fine (the left column on the pic below). But if I'm using my web application to generate an excel report file (PHP, using CodeIgniter and Laravel). It displays an error " 'Wrong number of arguments for INDEX() function: 5 given, between 1 and 4 expected' " Here's my sample code snippet: $code = "=INDEX(\$E\$4:\$E\$

Write to multisheet excel using phpspreadsheet in php

旧街凉风 提交于 2019-12-25 00:22:31
问题 I manage to write into excel file using phpspreadsheet... but for single sheet only. I try to create multisheet but failed.. appreciate your help to assist. Below are my codes..Thanks in advance. public function exportAll()( { $e = 2; // Row start at 2 $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $data1 = $this->model_general->get_data1(); $sheet->setActiveSheetIndex(0); //Excel Heading $sheet->setCellValue('A1', 'Date'); $sheet->setCellValue('B1', 'Details'); //

Writing xlsx file with PhpSpreadsheet deletes all the textboxes

本小妞迷上赌 提交于 2019-12-24 11:15:05
问题 I'm creating a system that reads/writes a spreadsheet using PhpSpreadsheet. Does this library support the use of textboxes? When I tried all the textboxes were deleted. 回答1: No, PhpSpreadsheet doesn't support any form elements; and features of Excel that aren't supported simply aren't loaded when the file is loaded, so don't exist in the spreadsheet object when it is saved 来源: https://stackoverflow.com/questions/54833862/writing-xlsx-file-with-phpspreadsheet-deletes-all-the-textboxes

phpspreadsheet setCellValue is not writing

南楼画角 提交于 2019-12-24 01:47:19
问题 I am uploading a excel file, reading the contents and writing to a new excel file using phpspreadsheet. I am trying to create a excel file. I am writing into cells using the following code $writesheet->setActiveSheetIndex(0)->setCellValue('A1','myemail@gmail.com'); these lines echo 'valid'; echo $cell; echo $toemail; print all the values correctly. But this line of code is not working.. Full code: <?php include '../includes/common.php'; include "class.emailvalidator.php"; ////////////////////

PhpSpreadsheet: Permissions | ZipArchive::close(): Failure to create temporary file

人盡茶涼 提交于 2019-12-23 15:14:07
问题 I would like to offer an Excel-File for download with PhpSpreadsheet Here is my code: require 'vendor/autoload.php'; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; $spreadsheet = new Spreadsheet(); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Hello World !'); $writer = new Xlsx($spreadsheet); $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); header('Content-Type: application/vnd.ms-excel'); header(

Setting width of spreadsheet cell using PHPExcel

て烟熏妆下的殇ゞ 提交于 2019-12-20 09:21:15
问题 I'm trying to set the width of a cell in an Excel document generated with PHPExcel with: $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('C')->setWidth('10'); $objPHPExcel->getActiveSheet()->getColumnDimensionByColumn('C')->setAutoSize(false); but that does not works. What is the method that I need to call here? 回答1: It's a subtle difference, but this works fine for me: $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10); Notice, the difference between

Excel - Getting the Top 5 data of a column and their matching title but produces duplicates

我与影子孤独终老i 提交于 2019-12-18 09:48:48
问题 I am developing a web application made using PHP (withh CodeIgniter as the framework) that should produce an excel file report as as summary of data. I am using PHPSpreadsheet as a library to generate the .xlsx file and everything is successful. I was able to display in a certain range of cell the top 5 values of a column ie. Top 5 Publications that has the most number of Articles . With the use of the code =LARGE(ColumnOfTheDataRange , NumeralValue) -- I was able to get the top 5 of what I

Excel - Getting the 2nd or nth matched string from your corresponding data

佐手、 提交于 2019-12-13 08:40:50
问题 With my previous posts 1. PHPSpreadsheet generates an error "Wrong number of arguments for INDEX() function: 5 given, between 1 and 4 expected" 2. Excel - Getting the Top 5 data of a column and their matching title but produces duplicates I have found out that the PHPSpreadsheet library for PHP is yet to allow the usage of the AGGREGATE() and complicated formulas/functions but I'm in dire need of their functionalities Going back, I have 2 columns in my Excel (produced by my web applications

Export .xlsx with PHPSpreadsheet reading a .php file that creates an HTML table

社会主义新天地 提交于 2019-12-11 16:19:45
问题 Is it possible to create an .xlsx spreadsheet using PHPSpreadsheet from a .php file that creates an HTML table? The .php file creates an HTML table from both POST and DB values. I'm able to successfully create an .xls file using just php header instructions. The closest I've gotten through PHPSpreadsheet is reading the .php file as HTML, which creates an .xlsx file but also generates php warnings in the browser about the filetype, and the .xlsx file contains all of the php code in addition to