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
1 answer
How to use PHP spreadsheet in drupal 7 for reading excel file and storing in database
I'm new in Drupal 7, I want to use PHP Spreadsheet in my project, but how much i know that PHP spreadheet module is available in Drupal 8, and for Drupal 7 we need to use it's library, so I followed this steps for PHP spreadsheet
Download the…

beginner_coder
- 68
- 5
1
vote
1 answer
phpoffice or any phpWord library that can add comment to a word document?
Is there any PHP Word Document Library that can allow me to add comments automatically,
Such as this sample below,
Wherein comments can be seen on the right side on the document,
I have tried PHPOffice but it doesn't seem to have any comment…

apelidoko
- 782
- 1
- 7
- 23
1
vote
0 answers
PhpSpreadheet BaseWriter not found in PhpSpreadsheet/Writer/Xlsx,php:32
I was using phpexcel on an old site (that doesn't even have composer), but i got stuck in this error.
Fatal error: Uncaught Error: Class 'PhpOffice\PhpSpreadsheet\Writer\BaseWriter' not found in…

Ezylpro
- 11
- 1
1
vote
0 answers
PhpSpreadsheet outputs encrypted text instead of starting the download
I'm creating an API with slimframework and I have a route where I'm trying to export data to an excel file and download it instead of saving it but when I try to do it it outputs text like this ��ࡱ�;�, the thing is that I have three ways of getting…

Carlos Balderas
- 21
- 1
- 2
1
vote
2 answers
Style & layout is not copied while creating new pptx from pptx in PHPPresentation
I want to split slides of one pptx file into seperated pptx files, containing one slide each. The content/text is copied but the layout & styling is not copied. Here is the code.
Can anyone please help ?

Rockers Niloy
- 101
- 2
- 12
1
vote
1 answer
Adding style to all link tags in PHPWord
I'm using PHPWord in order to parse HTML content and generate a .docx file from it.
I want to add style to all tags so they'll look like HTML links in a web page, e.g: blue with underline.
right now they was they look in the generate .docx file is…

rami300
- 69
- 9
1
vote
0 answers
How to set column in PhpSpreadsheet to String
im trying to save my data from excel to database.
in my column i have data like this 6.0110000, when i save my data changed to 6.011.
how i can keep my data to 6.0110000, look like it remove all 0 after comma.
my code is like this:
$spreadsheet =…

Jazuly
- 1,374
- 5
- 20
- 43
1
vote
1 answer
Zipping exported files in laravel
I have installed phpoffice/phpword package on laravel to export multiple files using a foreach loop inside my controller (please refer to code below). Each file is named after by the according id number, eg. 15_en.doc, 16_en.doc etc, and all files…

Konstantinos
- 51
- 1
- 14
1
vote
0 answers
PHPSpreadSheet: Combining csv files into one sheet
I'm using PHPSpreadSheet to create csv files. What I need to do is combine several csv files into one. For example:
FILE A:
ROW 1: one, two, three
FILE B:
ROW 1: four, fix, six
What I'd like to generate is:
COMBINED FILE:
ROW 1: one, two, three
ROW…

Richard Crawford
- 11
- 1
1
vote
1 answer
how to add table in phpword with laravel
i am trying to draw a table in phpword with laravel
code below is example of writing something in the doc file.
$wordTest = new \PhpOffice\PhpWord\PhpWord();
$newSection = $wordTest->addSection();
$desc1 = "The Portfolio details…

Abidus Sattar Aziz
- 135
- 3
- 15
1
vote
0 answers
Class Zip Archive not found using PhpSpreadsheet (Mac)
I'm using the latest XAMPP, and I've downloaded PhpSpreadsheet with composer, but upon requesting the file, it says that Class 'ZipArchive' is not found.
This is my code so far:
$file = './data/data.xlsx';
$spreadsheet =…

Biki Bico
- 35
- 6
1
vote
1 answer
How to set text in multiple columns?
How to can put the text in two columns, for example (A1:B1 , 'hello world')?
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
$spreadsheet = new Spreadsheet();
$sheet =…

Juan Carlos Quiles Estruch
- 175
- 1
- 14
1
vote
1 answer
file_get_contents not working on CentOS 7
I was using phpoffice template processing functionality with Laravel and it worked on Ubuntu, Windows and Mac. The functionality stopped working when I migrated to centos server. I figured out that the phpoffice was calling file_get_contents to open…

Anshad Vattapoyil
- 23,145
- 18
- 84
- 132
1
vote
0 answers
Why is phpword ignoring paragraph styles in html lists?
I'm adding html to phpword of an unordered list. Font styles pull through fine (on the list items), but paragraph styles are completely ignored.
This on my list item works fine:
phpword
phpoffice

Nicolas Goosen
- 583
- 5
- 14
1
vote
0 answers
How to format PreserveText in phpoffice / phpword
Using PHPOffice/PHPWord, I'd like to format the page numbers in my footer so that the numbers are bold, and rest of the text is plain, like this:
Page 3 of 10
At the moment I've got:
$footer->addPreserveText('Page {PAGE} of {SECTIONPAGES}',…

Nicolas Goosen
- 583
- 5
- 14