Questions tagged [phpword]

PHPWord is a library written in pure PHP that provides methods to create/write word processor document formats (Word 2007, Open/Libre Office and Rich-Text Format).

PHPWord is a library written in pure PHP that provides a set of classes to write to and read from different document file formats. The current version of PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open Document Format for Office Applications (OpenDocument or ODF), Rich Text Format (RTF), HTML, and PDF.

PHPWord is an open source project licensed under the terms of LGPL version 3. PHPWord is aimed to be a high quality software product by incorporating continuous integration and unit testing. You can learn more about PHPWord by reading the Developers' Documentation and the API Documentation.

It is a component of the PHPOffice suite of libraries, comprising PHPExcel, PHPWord, PHPPowerPoint, PHPProject and PHPVisio.

The current production release of PHPWord is version 0.13.

Resources

689 questions
21
votes
1 answer

Insert RTL text correctly in PHPWord template

I'm using PHPWord template processor to insert some text in a template. The word template is formatted LTR as all the labels are English. Here is the line in the word template: User Name: ${name} Here is the PHP line that replaces the…
Amr H. Abd Elmajeed
  • 1,521
  • 15
  • 41
20
votes
3 answers

Finding and replacing text with PHPWord

Is it possible to just do a simple find and replace for text on a Word document using PHPWord? From what I've seen, the closest you can get is just ADDING text to a section, and you can't manipulate existing text except for font, etc. If not, is…
Someone
  • 372
  • 1
  • 2
  • 13
16
votes
4 answers

Generate PDF from .docx generated by PHPWord

I am creating .docx files from a template using PHPWord. It works fine but now I want to convert the generated file to PDF. First I tried using tcpdf in combination with PHPWord $wordPdf =…
Pinguin895
  • 999
  • 2
  • 11
  • 28
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
15
votes
2 answers

How to convert the html tag string to a word document using PHPWord?

I have a HTML string and I want to print in the word document in same format and style as in the HTML. I am using the PHPWord When I give my HTML string say: $htmlval ="
OFFER…
user2651906
  • 193
  • 1
  • 5
  • 10
15
votes
7 answers

Auto download the file attachment using PHPWord

I'm trying to use PHPWord to generate word documents. And the document can be generated successfully. But there is a problem where my generated word document will be saved on the server. How can I make it available to download straight…
JLearner
  • 1,271
  • 9
  • 27
  • 40
12
votes
2 answers

How to convert Word document into PDF using PHPWord

I am creating a Microsoft Word report using PHPWord. I basically start with a template and populate the fields and save it as a word report. I would like to convert this report into a pdf file. I tried loading the generated doc file through…
Kiran
  • 8,034
  • 36
  • 110
  • 176
12
votes
2 answers

Making DomPDF as my pdf writer for phpWord

I used laravel for my app and the dompdf is found in: ../vendor/dompdf/dompdf What I wanted to achieve is to convert my .docx file (Microsoft Word) to .pdf file. The docx file was generated by phpWord by loading the template file and replacing…
Bajongskie
  • 453
  • 2
  • 9
  • 22
12
votes
9 answers

How to add/set images on PHPOffice/PHPWord Template?

I have an instance of a template on PHPWord. Is it possible to replace or add an image? Something like a setImageValue? $phpWord = new \PhpOffice\PhpWord\Template('a.docx'); $phpWord->setImageValue('IMAGE_PLACEHOLDER',…
Diogo Melo
  • 1,735
  • 3
  • 20
  • 29
12
votes
10 answers

PHPWord how to add text break / new line while in a text run

How can I add a text break or go to the next line/row while in a text run? I tried to just do $section->addTextBreak(2); while in the text run but it just added the breaks to the section after the text run. I also tried $textrun->addTextBreak(2);…
user2579723
  • 213
  • 2
  • 3
  • 5
12
votes
3 answers

manipulating template in PHPWord

I am using a word document generator for PHP for the reports module of the web-app i am developing. I choose PHPWord because the free version of PHPDocX has very limited functionality plus it has a footer that it is only a free version. I have a…
11
votes
1 answer

PHP Word, send generated file to browser as output without saving it on disc

I'm using PHP Word & htmltodocx_converter to create a word document, all works well but I just need an example of how I can send the file to browser for download without saving it on disc. All examples I see you save the file to your disc: // Save…
Morgs
  • 1,558
  • 3
  • 19
  • 34
11
votes
7 answers

PhpWord doesn't replace text

I have a docx file and I need to replace some text. This is done inside codeigniter framework; here is the code: $this->load->library('word'); $template =…
pindol
  • 2,110
  • 6
  • 35
  • 52
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
1 answer

Error converting .docx file (with .emf image background) to PDF

A Laravel-based application is converting documents (.doc, .docx, .pdf, .png, .otd, html, etc) to PDF so that they can all be merged together into a master PDF document. It is using a combination of plugins like PHPWord and DOMPDF Wrapper to do the…
cfnerd
  • 3,658
  • 12
  • 32
  • 44
1
2 3
45 46