680 questions
0
votes
0
answers
81
views
Parsing Word docx file gives "Namespace prefix m on oMath is not defined in Entity" [duplicate]
i am creating laravel project that parsing word doc and docx file into elements in json format. I use phpword library and loading IOFactory::load($path) code. In loading time i get error
DOMDocument::...
1
vote
1
answer
87
views
PhpWord generates paragraph breaks in addhtml
I am using PHPWord from within PHP to generate a word docment. I do use addHtml to transform some Mysql text containing multiple lines into a Word paragraph.
My input text contains:
<pre>
Lorem ...
1
vote
0
answers
85
views
PhpWord and \n in line together with HTML code
Using PhpWord in my PHP project gives me issues.
I do have a variable containing CR/LF (\n) and HTML code.
Something like:
$str='<div style="font-style: italic; text-align:center">...
1
vote
2
answers
129
views
How to Replace DOCX Placeholder with Formatted HTML in PHPWord where data came from the HubSpot?
I'm using the PHPWord package in Laravel to replace placeholders in a DOCX template.
I have a placeholder ${html} in my DOCX file, and I'm trying to replace it with HTML content like:
<p>Hello,&...
0
votes
0
answers
64
views
PHPword images that are in HTML not adding to the word document
I have a template word document with a placeholder that needs to be replaced by HTML code. That HTML code has test wrapped images as well. Ill break down my requirement and the issue below.
...
0
votes
0
answers
37
views
phpWord make Table of Contents text different from section titles text?
In phpWord, I would like to modify the text that appears on the Table of Contents to be different from what appears in the individual section titles.
// Add title styles
$phpWord->addTitleStyle(1,[]...
0
votes
0
answers
24
views
Applying template formatting using PHPWord [duplicate]
I've written a Laravel application that generates content for documents and inserts it into existing Word templates using PHPWord. My desired approach is pretty simple:
I generate the content that I ...
0
votes
0
answers
225
views
Formatting with PHPWord's Template Processor
I'm writing code that inserts sections of content into a pre-defined Word template using PHPWord. I put tags like ${INTRODUCTION} in my template, and then I use the Template Processors's setValue ...
-2
votes
1
answer
48
views
DomPDF Class PreserveText not found
I downloaded and installed the dompdf release http://dompdf_3-0-2.zip/
I am not using composer, so I added this line:
require_once '../dompdf/autoload.inc.php';
Running some sample code:
$phpWord = ...
0
votes
0
answers
21
views
Addimage() creates unwanted text line in PhPWord
Using this code with PhPWord, the addImage() function seems to inject a line break.
$Format['width']=36;
$Format['height']=36;
$Format['wrappingStyle']='square';
$Format['positioning']='absolute';
$...
0
votes
0
answers
59
views
WORD docx dokument created with phpWord not readable by MS Word 2021
I have created a WORD docx document with phpWord. It can be opened and looks ok (just as intended) with LibreOffice (newest version).
I do not have a WORD version myself but a colleague told me it ...
-1
votes
1
answer
67
views
How using phpword delete personal data left in word template when generate file?
When generating a file from a word template, is it possible to delete personal data left in the template? For example, the author's name.
I checked if the author's name is left in the template, in the ...
0
votes
1
answer
92
views
PHPWord bracket causes rendered Word document to be un-openable
Using PHPWord, I've managed with this line:
$section->addText('<');
to provoke an Error in Microsoft Word opening the .docx file:
+---------------------------------------------------------------...
1
vote
1
answer
175
views
The image showing in docx file is not visible in pdf when converted using unoconv
The image showing in docx file is not visible in pdf when converted using unoconv where the image is displayed using
$document = new \PhpOffice\PhpWord1\TemplateProcessor($docx_temp_file_path);
$...
0
votes
0
answers
73
views
How to Add Font Styling to Paragraph Style when Creating Word Document in PHPWord
When creating word documents, PHPWord allows for defining custom paragraph styles, which in turn text content can be assigned to. The features that can be defined when creating paragraph styles seem ...
1
vote
1
answer
118
views
PhpWord Samples Manual Install
The documentation for Manual Install is out of date. I tried to manually write an Autoloader class and maybe it worked? but the only output I get in Sample-01.php is 02:56:03 Create new PhpWord object
...
1
vote
0
answers
36
views
Replacing keywords in a DOCX file via PHP
Im trying to do an offline file filler (but they specifically asked for a browser experience so aigth) for a company that does the same paperwork over and over again. they assigned me to do a fairly ...
0
votes
1
answer
34
views
remove paragraphs in phpWord table
There is a space in the table. I couldnt remove it. It's not just a space, tab, align or 4space. this image is the wrong one, it should be like this this image is the true one
$information = ...
1
vote
1
answer
138
views
Replace values in a template table with templateProcessor
I have a doc template which contains the following table:
and with php I fill the variable with this line:
$templateProcessor->setValues(array("{key1}" => 59, "{key2}" => ...
1
vote
1
answer
82
views
$templateProcessor->deleteBlock('mostCompetitive'); is not working in phpWord in Laravel
I am using PhpOffice\PhpWord\TemplateProcessor to modify my template DOCX document and its setValue method works well.
but I am not sure how to use $templateProcessor->deleteBlock();
Here is my ...
0
votes
0
answers
39
views
Displaying the same styling from a word document to vue
I'm using laravel 9, vue 3 and phpoffice/phpword. I've also uploaded a word document which lives in my storage folder and that word document has stylings in it.
What I'm trying to do is display that ...
0
votes
0
answers
113
views
PHPWord replace placholder with html
So I have in my word document a placeholder: {{ test }}. I want to replace this placeholder with some html. But I can't seem to get it working an I do not know why.
This is the error that I'm getting:
...
0
votes
1
answer
654
views
Convert Word File to PDF using PHPWord library
I attempted to convert my Word document to PDF, but the formatting was lost and did not match the original. Specifically, I was converting a certificate from a Word file to PDF, resulting in incorrect ...
0
votes
1
answer
145
views
PhpOffice\PhpWord 1.2.0 - TemplateProcessor add numeric list item dont work
if (!empty($params['responsibilitiesItems'])) {
$cnt = count($params['responsibilitiesItems']);
$templateProcessor->cloneBlock('responsibilitiesItems', $cnt, true, true);
$section = new ...
0
votes
1
answer
622
views
PhpOffice/PhpWord image wrapping doesn't work
I use PhpWord to generate a .docx file using TemplateProcessor. In the script, I include an image with a statement
$templateProcessor->setImageValue('aName', [
'path' => '/path/to/file',
...
1
vote
1
answer
333
views
PHPWord table column span (gridSpan) not work as expected
I'm using PHPWord to create a table like this:
But I got this:
My Code:
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$fullWidth = 11906.85;
$...
1
vote
1
answer
569
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 ...
0
votes
0
answers
114
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 '../...
0
votes
1
answer
511
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 ...
1
vote
0
answers
104
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 ...
1
vote
0
answers
161
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 ...
1
vote
0
answers
171
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";
}
...
0
votes
1
answer
154
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 ...
0
votes
0
answers
80
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 ...
0
votes
0
answers
87
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 ...
1
vote
1
answer
5k
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', $...
1
vote
2
answers
339
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 ...
0
votes
2
answers
119
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 ...
0
votes
1
answer
957
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.
$...
-1
votes
1
answer
442
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 ...
0
votes
0
answers
293
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
$...
0
votes
1
answer
843
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[&...
0
votes
1
answer
137
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 ...
0
votes
1
answer
260
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, [
...
1
vote
0
answers
222
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
...
0
votes
0
answers
411
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\...
1
vote
1
answer
1k
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/...
1
vote
1
answer
504
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 ...
0
votes
1
answer
373
views
Add nested table into word by phpword library and DOM object
I have a Full HTML text which needs to be converted accordingly to phpword and added finally in word.
HTML code is :
$html = '<table style="height:500px;width:600px;"><thead><...
-1
votes
1
answer
204
views
phpword templateProcessor return value?
What is the return value of $template_processor->saveAs()? , i tried to catch the return value to determine whether the process is successfully executed or not
public function create_spm($data_spm){...