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).

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

PHPWord generate file from template and send it to ajax

I work with PHP 7 and PHP Word. I generate a file using a Word template and save it to my app's main folder. The PHP file that is generating the word file is triggered by an ajax call like this: $....
Stavros B's user avatar
  • 177
1 vote
1 answer
41 views

Autofit PhpWord table to window

I want to autofit phpword table to window. So, I has add array('unit' => 'pct', 'width' => 5000) when create table. But , the table column show in reversed order in output docx file. I don't ...
Premlatha's user avatar
  • 1,768
0 votes
0 answers
8 views

phpword Document protection on parts of document

phpword documentation says: The document (or parts of it) can be password protected. $documentProtection = $phpWord->getSettings()->getDocumentProtection(); $documentProtection->setEditing(...
Wolf-Tilmann's user avatar
0 votes
0 answers
37 views

set no border to table not working when generate pdf from phpword

I have created table using phpword. Cell 1 has border, cell 2 has no border. when I generate pdf, whole table come out with borders. I have use tcpdf renderer to generate pdf <?php include_once '../...
Premlatha's user avatar
  • 1,768
0 votes
1 answer
24 views

How to remove border in PhpWord table?

I has create table using phpword. I want set border for specific cell only. For testing, I have create two array style, border=6 and border=0. I set style1 to cell 1 and style2 to cell 2. In word file ...
Premlatha's user avatar
  • 1,768
-1 votes
0 answers
32 views

Generated PHP to Word With Full Images

I have report generated from php. I was able to make it php to pdf. But, I want to add feature button php to word so I can edit the report. I use ob_start() and ob_get_contents(); I was searching 6 ...
Mukhlis Saputro's user avatar
0 votes
1 answer
25 views

PhpWord-TemplateProcessor does not replace values

I'm trying to replace some content into a docx file but even if the saveAs works properly I dont see any modification in the new document. Here is my code : require 'vendor/autoload.php'; use ...
Nirnae's user avatar
  • 1,345
0 votes
0 answers
21 views

PHPWord Wordfile generated from template results in broken background images

I want to load a .docx template, replace some tags and save the document. The first test with just opening and immediately saving the document without changing anything fails because all the images ...
Chris's user avatar
  • 135
1 vote
0 answers
25 views

PHPWord generated charts don't display when saving as PDF

I'm running some reporting via a bespoke Laravel system. These reports are generated as docx files using PHPWord and are then converted to PDF via dompdf and saved to disk. The docx file is generating ...
E.Owen's user avatar
  • 785
1 vote
0 answers
31 views

Tiny Editor html content on PHPWord

We are trying to create a word document with phpWord. The word file contains html and we are saving the html with tinyeditor (tinyMCE) to db. From an api call, it returns html that is from tinyMCE and ...
Kevinhub-tech's user avatar
1 vote
0 answers
55 views

Problem with phpword converting docx to html

I'm attempting to convert a DOCX document to HTML using the PHPWord library. However, during the conversion process, it doesn't include images, backgrounds, headers, or footers. It only retains tables ...
user2048789's user avatar
0 votes
0 answers
21 views

is there any way to detect count of pages any word document created by PhpWord?

By PhpWord how detect count of pages, it is really very big problem create word document by using PhpWord and unzip created document but in unzipped file at app.xml file does not contain page property....
euler's user avatar
  • 1
1 vote
0 answers
45 views

PhpWord running problem - no such file PhpWord.php

I try to run PhpWord on server but have issue. autoload.php <?php function loadLibraries($class) { $path = __DIR__.'/lib/'; require_once $path.$class.".php"; } ...
Stanley01's user avatar
0 votes
0 answers
14 views

phpword crates file on windows but not on linux

maybe anyone can help me. For development I use XAMPP. Because I can use it in Office. I worte some pages to crate docx-files. Using XAMPP they work. Right system works on Linux. I copied my files in ...
Wolf-Tilmann's user avatar
0 votes
1 answer
48 views

Multiple comments.xml files from PhpWord

I am using PhpWord to create a document that contains comments. I can create the file successfully, but when I try to open it, Word reports that it contains unreadable content. Although Word will ...
Doom_Cat's user avatar
0 votes
0 answers
42 views

how to interact with MS Word content controls using PHP?

I have been tasked to create a document control system written in PHP which utilises existing word templates. The templates have content controls which I must populate from MySQL database. I am ...
JJ279's user avatar
  • 9
0 votes
0 answers
48 views

Any way to preserve phpWord placeholders when populating MS word content from MySQL database using php?

I am building a document workflow system (in PHP) which utilises word templates. I will populate some content (document number, title, issue, and signatures) from a mySQL database. The rest of the ...
JJ279's user avatar
  • 9
0 votes
1 answer
465 views

How to use template processor from PhpWord with more complex sections like tables, images, links?

How to use template processor to add more content than just simple values? $templateProcessor = new TemplateProcessor(resource_path('prints/form.docx')); $templateProcessor->setValue('date-now', $...
DaveLV2's user avatar
  • 167
0 votes
0 answers
40 views

Page numbering when multiple sections are added in PhpWord

I have two sections in my PhpWord and i cannot get it automatically count page numbers in footer and in Table Of Contents. Is there a way to have page numbers go from 1 to final page number, although ...
gagitron's user avatar
0 votes
0 answers
32 views

How to change Page numbering start in phpword templateprocessor?

I had *.docx template file where in header i use page numbering. But how in templateprocessor change PageNumberingStart number. Ive try to add section to template, but it doesnt work. Is any ideas how ...
user2736875's user avatar
1 vote
2 answers
130 views

mkdir(): No such file or directory Error In PhpWord and Laravel 10

Am trying to save a word document using PhpWord 1.0 object Writer within the storage folder in laravel 10 but am getting an exception "mkdir(): No such file or directory". The logic is as ...
peter chege's user avatar
0 votes
0 answers
42 views

Merge Cells on TemplateProcesscor PHPWord

I have table in my template in TemplateProcessor PHPWord. I want to ask if I can merge the cells using TemplateProcessor? In the documentation, there is only cloneRow() method and such merge cell ...
Oneddd's user avatar
  • 1
0 votes
1 answer
45 views

phpword 0.18.2 integration with phpstan

There are phpstan configuration files in the phpword sources https://github.com/PHPOffice/PHPWord/tree/0.18.2 , but composer does not include these on phpword installation, thus there are none of ...
Alexandr Shavykin's user avatar
0 votes
0 answers
19 views

Is it possible to define meta data of a placeholder in php word template?

I am implementing a feature in my web application where I create documents from templates. I am using PHP word template processor for it. I have the following questions: How can I define styling of ...
Musawar's user avatar
  • 93
0 votes
0 answers
44 views

PhpWord: cannot set Cell style from Style object

I am manipulating a Word document I got from users. I need to make copies of a table, or maybe of its containing sections; but I cannot convert it into a template, because I have also to use PhpWord ...
Francesco Marchetti-Stasi's user avatar
0 votes
0 answers
51 views

Problem with table borders when loading a DOCX document using the PHPWord library

I am using a PHP library to read a DOCX document and convert it to HTML. The document contains two tables, but the first table doesn't have borders. The issue is that when the document is converted to ...
user2048789's user avatar
0 votes
1 answer
154 views

Convert a docx file to HTML without HTML, HEAD and BODY tags using PhpWord

Hi I am using PhpWord to convert a docx file to a html file. This works well however it contains HTML, HEAD and BODY tags, how do I convert a file without these tags, just the body content. $...
user3459394's user avatar
0 votes
0 answers
198 views

How to convert, or read a .doc file with PHPWord?

I've crawled this and other websites and found no solutions to this: I'm trying to read the text from a .doc file using PHPOffice/PHPWord and all the code I've tried has failed. I can read .docx files ...
Grimcall's user avatar
0 votes
0 answers
86 views

PHPword Fatal error: Uncaught Error: Call to a member function write() on null in phpoffice\PhpWord\Writer\Word2007.php on line 137

my phpword is not working and showing the following error Fatal error: Uncaught Error: Call to a member function write() on null in phpoffice\PhpWord\Writer\Word2007.php:137 Stack trace: #0 test.php(...
Baiju Mathew's user avatar
0 votes
0 answers
79 views

PhpWord , templateProcessor and setMacroChars

With the latest version of phpWord, is it possible to change the macro characters with the setMacroChars method? The default macro characters are ${ and }, but I've tried many combinations and only ...
Sergio's user avatar
  • 1
0 votes
0 answers
71 views

DOMDocument::loadXML(): Opening and ending tag mismatch: br line 1 and p in Entity, line

This code fetches a service request from the database, retrieves the request data and service information. It uses an HTML template and replaces placeholders with actual data. Then, it generates a ...
Who Do You think am i's user avatar
-1 votes
1 answer
135 views

phpword set image dimension in template

I'm using phpword to add text and images to a .docx. I can add pictures that are identified by a placeholder just fine (for example ${TM-TA-PICTURE-FRONT} ), but if I try to set dimensions it ignores ...
Paulo's user avatar
  • 19
0 votes
0 answers
165 views

Problems generating a DOCX document from a template with phpWord and then converting it with LibreOffice to PDF on Ubuntu

I have template.docx template with mark ${table} inside. I create document.docx using phpWord and need to convert it to PDF using LibreOffice on Ubuntu. Here is my code v1 filling table $...
Garry's user avatar
  • 81
0 votes
0 answers
36 views

PHPWord : word doc loses table/cell border formating in Windows

l have a project in Symfony 5, ubuntu 20.04 and l created a functionality to generate word templates using phpWord. To format the template, I am using the library methods like ->addRow(), ->...
Nick's user avatar
  • 1
0 votes
1 answer
233 views

How to set PSR logger version 3 within PHPWord PDF renderer

I have PHP 8.2. with PHPWord and MPDF, installed via composer. I do not know how to properly set psr logger version. The error is: My code is: \PhpOffice\PhpWord\Settings::setPdfRendererPath($_SERVER[&...
Dux's user avatar
  • 69
0 votes
0 answers
236 views

Problems installing PHPWord in PHP 5.5.11

I have the following problem while installing PHPword from composer. I download version 0.13.0 of phpword and version 2.0 of composer but I get the following error: Problem 1 - laminas/laminas-...
stark2307's user avatar
0 votes
0 answers
75 views

How to set fontsize for a custom paragraph style created by addParagraphStyle method in phpword in php

I have a custom code written for php to generate word. I want to create new custom paragraph style 'MyStyle' and it needs to be generated like font size '18' and style 'Calibri'. Here is my code as ...
Dinesh Chandra's user avatar
0 votes
0 answers
315 views

How to read a .docx file in Laravel?

I have a laravel app, version 5.39. I'm using phpoffice/phpword 0.15 library. I'm trying to upload a .docx file and read its content. I tried this: $phpWord = IOFactory::createReader('Word2007')-&...
Tom Bom's user avatar
  • 1,629
0 votes
0 answers
28 views

creating a subtable in phpword

i would like to add a subtable to the an already working table in phpword. here is what i have done: $row = $table->addRow(); $cell = $row->addCell(); $subtable_obj = new Table(array('align' =&...
composersucks's user avatar
0 votes
0 answers
29 views

PhpWord add footer content from specific page

I am using simple code to add footer to DOCX, or DOC document via PhpWord library. $footer->addPreserveText('My Sample Content'); But I want to start adding this content from for example page 6. ...
Mario's user avatar
  • 187
0 votes
0 answers
234 views

set toc via TemplateProcessor using phpword

Template.docx has predefined topic(heading1). I load Template.docx in templateprocessor to create table of content based on predefined heading. Template.docx layout ${TOC} pagebreak Topic1 createToc....
Premlatha's user avatar
  • 1,768
0 votes
1 answer
49 views

phpword create multiple object link to different sheets in same excel file

I create multiple object which link to different sheets from same excel file using phpword template processor. I have create customized function in template processor.php to create object link to ...
Premlatha's user avatar
  • 1,768
0 votes
1 answer
97 views

How do I replace the placeholder in the footer?

there is a code like this: $templateProcessor = new TemplateProcessor('path to DOCX file.....'); $table = new Table(['unit' => TblWidth::AUTO]); $table->addRow(); $table->addCell(null, [ ...
Mister X's user avatar
0 votes
0 answers
13 views

PHPWORD add cell bgcolor using search pattern

I'm really new to phpword and would like to ask if it's possible to add cell bgcolor using search pattern? here's my code: Route::get('/test', function(){ $path = "tpl/standard....
Sam Teng Wong's user avatar
1 vote
0 answers
90 views

Only last page heading added to TOC in phpword

I am creating table of content using phpword from heading 1. I have added 2 heading 1 in different page. The heading 1 on last page only added to table of content in output file. <?php ...
Premlatha's user avatar
  • 1,768
0 votes
0 answers
268 views

PHPWord: Insert indentation and style in markup in docx

PHPWord: I have a code where I use the PHHWord library, where it receives from a checkbox the HTML order to insert text snippets in a docx file (in this case, model.docx). It turns out that to access ...
Guilherme silva's user avatar
0 votes
0 answers
202 views

PHPWord: Text inside table cell isn't fitting in one line

My code: <?php require "vendor/autoload.php"; $phpWord = new \PhpOffice\PhpWord\PhpWord(); \PhpOffice\PhpWord\Settings::setCompatibility(false); \PhpOffice\PhpWord\...
user avatar
0 votes
0 answers
65 views

Add chart to word template with PhpWord

Good day! In PhpWord one can generate a chart with: $chart = $section->addChart('pie', array('A', 'B', 'C', 'D', 'E'), array(1, 3, 2, 5, 4)); I'd like to add that chart to a doc template that uses $...
Fabbio's user avatar
  • 353
1 vote
1 answer
492 views

PHPWord: unable to generate word document file in PHP

I am new to the PHPWord library, and have just now installed it using composer. I want to generate a basic word file. This is my code: <?php // (A) LOAD PHPWORD require "vendor/...
user avatar
1 vote
1 answer
315 views

How to split docx / pdf file pages in Laravel 9

I have an online library application that allows users to search the content of books by keywords. To add a book to my application, I want to be able to upload the docx file of the book, then extract ...
Kmaj's user avatar
  • 81

1
2 3 4 5
14