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
1
vote
0 answers
Save a graph from PHP Spreadsheet to PHP Word
Good day!
I created a graph on PHP Spreadsheet using PhpOffice\PhpSpreadsheet\Chart\Chart.
Is there any way I can use/convert/ember/export this graph so that I can add it to a word doc programmatically?

Fabbio
- 343
- 2
- 16
1
vote
2 answers
Error while exporting Excel using PHP Spreadsheet and CodeIgniter 3 in PHP 8.2
I'm facing an issue while exporting Excel using PHP Spreadsheet and CodeIgniter 3 in PHP 8.2. The error message is shown in the following image:
Here is the code snippet that I'm using:
$fileName = 'activityReport.xlsx';
…

Pratik Purohit
- 61
- 9
1
vote
0 answers
Change the text size in a Phpoffice/PhpPresentation AutoShape
I want to change the default text size of a AutoShape in PhpOffice/PhpPresentation
Following the example of :[https://github.com/PHPOffice/PHPPresentation/blob/develop/samples/Sample_21_AutoShape.php]
I defined my code:

user20511268
- 11
- 2
1
vote
0 answers
How to make overlapping image in PhpOffice\PhpWord?
I have a document with verious variables in it. Need to put a .png stamp that'll be right on top on them. Is it possible?

Den
- 17
- 3
1
vote
0 answers
Remove Conditional formatting in protected sheet
I has a big problem. I read a xlsx to fill out it with data. If I save it as xlsx and load it in Excel there is a problem with the color of some cells.
A cell with the value a or n should be red. With x oder e it should be white.
If I load the…

diabolus Umarov
- 11
- 2
1
vote
0 answers
PHPOffice/PHPPresentation (PowerPoint) how to put a chart (createChartShape) inside a table cell?
By following the docs I found how to draw a chart directly inside the PowerPoint slide like this:
$seriesData = array(
'Monday' => 12,
'Tuesday' => 15,
'Wednesday' => 13,
);
$series = new…

Vlado
- 3,517
- 2
- 26
- 24
1
vote
1 answer
phpspreadsheet how to change the data set assigned to a chart in a template file
I am reading in a template file that has a series of charts. The charts on sheet "Charts" are based on data sets from a second sheet "RawData". I am trying to change the data set/range that feeds the chart - my assumption is that simply changing…

rolinger
- 2,787
- 1
- 31
- 53
1
vote
1 answer
phpspreadsheet how to replace an image in a template
Is it possible to swap out images in existing template file?
In my excel xlsx template file are three images. Each image has its own unique name/title (IE: "imageBanner_1"). Each image is in a location in reference to where certain charts are on…

rolinger
- 2,787
- 1
- 31
- 53
1
vote
1 answer
How to set cell as percentage in xls - phpoffice
Hey all I want to set the format of a cell in xls to percentage.
I am using phpoffice.
the value that I want is 0.04% as percentage.
the problem the origin $innervalue is 0.04% as string.
this is my code:
if($column == 'E')
…

Bastian
- 1,089
- 7
- 25
- 74
1
vote
0 answers
How to get multiple colors in a cell
Currently I'm using PHPOffice library for importing my data from a excel spreadsheet.
My excel spreadsheet is a little special, there is a cell having multiple styles.
I can get styles like font-size, font-weight, etc. But can't get color.
When I…

Yoshida J
- 11
- 1
1
vote
0 answers
phpOffice is not converting .docx file to pdf. it shows error DOMXPath::query(): Undefined namespace prefix in Laravel
hello guys i am working in laravel 5 and trying to convert my .docx files to pdf files. If there is only text in .docx file it converts successfully. But if there is any image in .docx file it shows following error
DOMXPath::query(): Undefined…

muhammad adnan
- 51
- 5
1
vote
0 answers
Server error downloading / generating Excel file in PHP
I am generating an Excel file with an sql query, this so that it shows me all the records, the problem is that it works correctly locally, the excel is generated and downloaded, but when uploading it to the server it sends me to the file where the…

julio fernandez
- 35
- 3
1
vote
1 answer
Is there a way to get sections from an IOFactory?
I'm using PHPWord to use a template but when I save my file in HTML format I only see its body and not the header or footer. So I would like to get these sections to insert them in the HTML part
$Content = IOFactory::load($saveDocPath);
$Writer…

leri
- 261
- 1
- 3
- 12
1
vote
0 answers
Read .doc file using phpoffice
currently, I am using phpoffice for doc reader. but there is a problem with the .doc file preview. work well in the .docx file but the problem in.doc file. how can I fix this issue?
i Used $phpWord = \PhpOffice\PhpWord\IOFactory::load($source,…

VUser
- 31
- 4
1
vote
0 answers
PhpWord: Loading template and saving as Word Doc removes table/cell borders
If I load a template - or even a straight document as a template, and do nothing else but save it, it removes the table/cell borders.
Here is my code:
$this->word = new PhpWord\PhpWord;
$this->template =…

Mr Mikkél
- 2,577
- 4
- 34
- 52