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
3
votes
1 answer
Cant set setPrintArea correctly
i'm using v1.3.1 of phpspreadsheet.
i'm building an excel file (download) and everything's working fine. The only problem a have is to define the setPrintArea... It always returning me standards PrintArea into excel. Basicly, i build the excels…
user4988206
3
votes
1 answer
docx to html with phpword issue
I'm encountering an issue when converting docx document into HTML with PHPWord library (https://github.com/PHPOffice/PHPWord).
Here is the code snippet I use:
$phpWord = \PhpOffice\PhpWord\IOFactory::load('test.docx');
$htmlWriter = new…

John Hunt Prax
- 35
- 1
- 6
3
votes
2 answers
unable to load file from url phpoffice/spreadsheet
Trying to load an .xlsx file from url but it gives error like,
Fatal error: Uncaught InvalidArgumentException: File
"http://localhost/test/csvfile/samplesms.xlsx" does not exist.…

sagar more
- 91
- 1
- 7
3
votes
2 answers
How to convert a PDF from Word with PHPOffice
I don't have any plan how can I convert an Word document, which I have as a string (blob) from my database, to a PDF via the PHPOffice library.
Concept:
I fetch an existing word document as an string from the database
Pass the string through an…

Julian Schmuckli
- 3,681
- 11
- 37
- 64
3
votes
2 answers
PhpOffice\PhpSpreadsheet Multiple worksheet not working
The following code is working only when I comment the Thrid sheet, I can see open and view the content which inserted, but when I include the Third sheet, it doesn't open the file but showing error,can’t be opened for some reason..
…

coderex
- 27,225
- 45
- 116
- 170
3
votes
4 answers
PhpExcel new line in cell
What I do:
query data from db
explode data and insert \n
prepare array
open tamplate
insert array into tamplate
try to replace \n with new line
How can I found \n and insert new line? For example I have in A1 next text "One\nTwo". I read text…

autumnrustle
- 595
- 1
- 10
- 21
3
votes
1 answer
PHPOffice PHPPresentation lose original styling on saving pptx
I have simple code that:
Load template pptx (*)
Duplicate few slides
Hydrate those slides with values (just replacing place-holder texts)
Save result to new file
Unfortunately PHPOffice's PHPPresentation is unable to retain slide styling present…

przemo_li
- 3,932
- 4
- 35
- 60
2
votes
1 answer
Convert doc or docx to pdf use tcpdf not matched
I trying to convert file doc or docx to pdf but the result doesn't match with the origin file doc/docx and also there is no style in file pdf. I don't know why, because here i'm using tcpdf and phpword
this is my code to convert:
$filetarget =…

chiper4
- 303
- 5
- 18
2
votes
1 answer
PHPOffice/Word - Error when generate multiple files from template
I'm using the PHPOffice/Word package to generate word files from template and i use Laravel 5.8 version running on PHP Server 7.3.29.
The generation works pretty good when i download only one word document, but when i want to generate multiple word…

Hippo
- 65
- 8
2
votes
2 answers
PHP Word - Remove placeholder from template so it does not leave a gap (blank line)
I'm using PHPWord to generate reports based on a template.
I replace placeholders in that template
$templateProcessor = new TemplateProcessor('template.docx');
$templateProcessor->setValue('placeholder_name', 'value5123');
and save the new…

Scaramouche
- 3,188
- 2
- 20
- 46
2
votes
1 answer
PHPOffice/PHPWord - How to setup paper size with landscape orientation
I did follow this post: How to change paper size in PHPWord
setSize('Letter');
$section =…

Manh
- 123
- 11
2
votes
0 answers
PHPOffice PHPSpreadsheet corrupted excel file
Working with PHPSpreadsheet to create a customized spreadsheet. We have two servers. On the first with ubuntu+apache all works fine . However, with the same code on the second server (centos+nginx) we have corrupted file. Code…

Denis Butorin
- 21
- 2
2
votes
1 answer
PhpWord doesn't replace text with TemplateProcessor
I encountered the same issue as @pindol in here.
I followed some steps provider by users in the page issue. So i tested functions in TemplateProcessor to see the outputs, and finally, the hole $TemplateProcessor with var_dump…

Moho
- 49
- 1
- 7
2
votes
2 answers
PhpOffice/PHPSpreadsheet chunk returns too many rows
I need to read a very large Excel sheet and am trying to use the chunk method in PHPOffice/PHPSpreadsheet.
The issue I'm having is that the loader is returning continually larger amounts of rows with each chunk. I'm expecting to get only a chunkSize…

Dave
- 41
- 4
2
votes
0 answers
How to read spreadsheet with no scientific notation?
Im loading a simple CSV file containing some long numbers.
-5605138260238298086
-5605138260238298086
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5605138260238297950
-5604797085080996904
Trying to do a basic load of this CSV…

user1231561
- 3,239
- 6
- 36
- 55