PHPOffice is an open-source collection of libraries used for reading and writing files in formats compatible with various "office" suites, such as Microsoft Office and OpenOffice.
Questions tagged [phpoffice]
242 questions
29
votes
2 answers
What are the main differences between PHPExcel and PhpSpreadsheet?
In project of PHPOffice there are two projects associated with spreadsheet file formats:
PHPExcel
PHPExcel is a library written in pure PHP and providing a set of classes that allow you to write to and read from different spreadsheet file formats,…

simhumileco
- 31,877
- 16
- 137
- 115
17
votes
3 answers
How do I extract the text content from a word document with PHP?
I want to extract the text content from the word document with PHP.
I have created a new word document in Microsoft Word for Mac 2011.
Edit: have also tested by creating the same document in Microsoft Word under Windows 7.
The contents of the…

Bohr
- 2,086
- 3
- 15
- 19
15
votes
5 answers
ZipArchive::close(): Failure to create temporary file: Permission denied nginx
I would love a good suggestion how to fix the following.
For a platform I have to create php word documents and it so happens that on the Apache dev environment this code executes perfectly; yet on the nginx platform I keep on receiving the error…

P070
- 189
- 1
- 1
- 10
10
votes
1 answer
No styling when converting DOCX into PDF with PHPWord
I am trying to convert a DOCX file to PDF with PHPWord. When I execute the script it looks like that some style elements are not converted. In the DOCX file I have one image, two tables with border 1px and hidden borders and I am using Tabs.
When I…

John
- 904
- 8
- 22
- 56
10
votes
4 answers
PhpSpreadsheet is corrupting files
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…

alex_6169
- 135
- 1
- 1
- 6
9
votes
2 answers
Open XLSX file that protected by a password with PHPSpreadsheet
I'm trying to open an Excel file (.xlsx) that is protected by a password with PHPSpreadsheet (documentation). I know the password but I don't find a way to open it.
The load()method of \PhpOffice\PhpSpreadsheet\Reader\Xlsx doesn't give the…

B 7
- 670
- 7
- 23
9
votes
2 answers
Dynamic Cell Merging in phpspreadsheet
My question is about generating an Excel sheet in codeigniter. The excel sheet sub-headings are not fixed, they are as per data, that's why i am not able to merge cells. Is there any solution for that? Ex:-Here sub-headings are not fix.

Abhilash Sharma
- 103
- 1
- 2
- 8
8
votes
3 answers
how to use excel sum formula in php phpspreadsheet?
I am using PhpSpreasdheet php library. I have done almost everything i want to sum the particular column and want to show total of that column.. See My output is coming below:-
My expected output like below:-
I have tried below code:-
$spreadsheet…

kunal
- 4,122
- 12
- 40
- 75
8
votes
3 answers
PhpSpreadsheet: Permissions | ZipArchive::close(): Failure to create temporary file
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…

Phantom
- 638
- 1
- 7
- 18
6
votes
5 answers
Laravel blade file to word document
I am passing data from my controller to my blade file, and then want to export the blade file to word document, so far things are controlled, I can export blade to word document, the issue is the document is not opening in Microsoft word it says…

kkarayat
- 392
- 1
- 5
- 14
6
votes
2 answers
PHPOffice/PhpSpreadsheet get cell column index as integer
How can I get cell column index as integer? I have searched the documentation but I didn't found anything.

user08
- 695
- 3
- 8
- 25
5
votes
1 answer
How to protect individual cell using phpspreadsheet
I want to protect particular cell content from being amended. When I tried to protect whole sheet, no problem.
$sheet->getProtection()->setSheet(true)->setDeleteRows(true);
But, could not set protection for individual cell. I tried the following…

Premlatha
- 1,676
- 2
- 20
- 40
5
votes
1 answer
phpoffice/phpspreadsheet - How to exclude no value cells from getHighestRow()
$eanStyle = new \PHPExcel_Style();
$eanStyle->getNumberFormat()->applyFromArray([
'code' => '0000000000000'
]);
/* apply styles */
$mainSheet->duplicateStyle($eanStyle, 'A2:A10000');
Code above generates .xlsx template file, user enters data…

Maytyn
- 122
- 1
- 10
5
votes
1 answer
PHPWord addTOC is not displaying page numbers
I'm using https://github.com/PHPOffice/PHPWord to generate a word document.
The function addTOC generates an index of pages with titles, but for some reason the page numbers do not display.
// add table of contents
$section->addTOC();
Results…

Geoff Maddock
- 1,700
- 3
- 26
- 47
4
votes
0 answers
How to add custom font to PhpOffice/PhpWord package
I am trying to generate .docx file from html with PhpWord package (here).
I want to use a custom Persian font (b-Nazanin) in my file. I got these formats of the font: (.ttf, .woff, .z, .cfg.z, .php).
Is there a way to add custom fonts to the PhpWord…

mohamadmamghaderi
- 41
- 1