phpword

Codeigniter and PHPWord

霸气de小男生 提交于 2019-12-23 09:27:01
问题 I'm trying to read some document. So I use PHPWord. Here what i got in my library. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH . '/third_party/PhpWord/Autoloader.php'; use PhpWord\Autoloader as Autoloader; Autoloader::register(); class Word extends Autoloader { } when i'm going to use it. I have this error : Fatal error: Class 'PhpOffice\PhpWord\Autoloader' not found in D:\xampp\htdocs\jdih\application\libraries\Word.php on line 6 A PHP

CodeIgniter PHPWord using as third_party

馋奶兔 提交于 2019-12-21 20:06:08
问题 I am trying to use PHPWord and having a difficulties to use it. This my code within application/libraries/words.php <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."/third_party/PhpWord/Autoloader.php"; \PhpOffice\PhpWord\Autoloader::register(); \\NOT SURE IF THIS IS CORRECT class Word extends PhpWord { public function __construct() { parent::__construct(); } } Based on PHPWord github, i must use it like this: Alternatively, you can download the

PHPWord addTOC is not displaying page numbers

Deadly 提交于 2019-12-20 10:55:50
问题 I'm using https://github.com/PHPOffice/PHPWord to generate a word document. The function addTOC generates an index of pages with titles, but for some reason the page numbers do not display. // add table of contents $section->addTOC(); Results in: If I echo the page numbers on the pages where the titles exist, they display fine. But they don't display in the TOC. I checked to confirm the text isn't white. 回答1: From PHPWord example in samples dir (https://github.com/PHPOffice/PHPWord/blob

PHPWord to PDF not able to load library

六眼飞鱼酱① 提交于 2019-12-20 03:47:10
问题 I have been trying all day to get this to work. Right now I am able to save the document as .docx file but I wanted to be able to save the document as PDF I have tried with DOMPDF and TCPDF but I keep getting error 'Unable to load PDF Library' I confirmed the path is correct. Am I missing something? thank you for your help $rendererName = \PhpOffice\PhpWord\Settings::PDF_RENDERER_TCPDF; $rendererLibrary = 'tcpdf.php'; $rendererLibraryPath = dirname(__FILE__) .'/plugins/tcpdf/' .

HTML Reader from PHPWord does't work with tables?

谁说胖子不能爱 提交于 2019-12-19 03:16:24
问题 When I use Html reader for my html for converting into docx, reader is cut off my table. PHP example: $reader = IOFactory::createReader('HTML'); $phpWord = $reader->load($this->getReportDir() . '/' . $fileName); $writer = IOFactory::createWriter($phpWord); $writer->save($this->getReportDir() . '/' . $fileName); Table example: <table> <tr> <td>№ п/п</td> <td>Общие показатели результатов прохождения проверочных листов</td> <td>Количество пройденных проверок</td> <td>% от общего количества

Auto download the file attachment using PHPWord

半城伤御伤魂 提交于 2019-12-18 05:49:04
问题 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 away? Sample: $PHPWord = new PHPWord(); //Searching for values to replace $document = $PHPWord->loadTemplate('doc/Temp1.docx'); $document->setValue('Name', $Name); $document->setValue('No', $No); $document->save('php://output'); //it auto save into my 'doc'

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

我只是一个虾纸丫 提交于 2019-12-13 11:36:09
问题 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 ="<h6><div style="text-align: center;"><b style=\\"font-size: x-large;\\">OFFER LETTER</b></div><font size=\\"3\\"><div style="text-align: center;"><span style=\\"font-size: medium;\\">(This goes as an email copy)</span></div>"; this is the HTML tags with break and div. to: $section->addText($htmlval); it prints all HTML tag but

PHPWord and images with width

烈酒焚心 提交于 2019-12-13 03:11:32
问题 $phpWord = new PhpWord(); $section = $phpWord->addSection(); \PhpOffice\PhpWord\Shared\Html::addHtml($section, '<table style="width:100%"><tr><td><img src="https://www.gettyimages.ca/gi-resources/images/Homepage/Hero/UK/CMS_Creative_164657191_Kingfisher.jpg" style="width: 20px;"/></td><td>text</td></tr></table>'); $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $objWriter->save($docx); In this case PhpWord display image with full size, and ignore image width How

PHPWord_Template save to client

余生长醉 提交于 2019-12-12 14:45:14
问题 I have download the package PHPWord_0.6.2_Beta.zip from this site There are 2 directory : Examples and PHPWord, and 1 file : PHPWord.php I put PHPWord directory and PHPWord.php in application/third_party and create new library named 'Word.php' in application/libraries as explained in this article Here is the new library code Word.php <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH."/third_party/PHPWord.php"; class Word extends PHPWord { public

PHPWord - Getting a count of pages?

自古美人都是妖i 提交于 2019-12-12 03:47:45
问题 I'm using PHPWord's template parser to make a document, then the command line to auto-print the document. The document MUST be on a single page, because it's a certificate, and is to be printed on special paper. I'm adding in peoples' names, so people with longer names could throw one line onto two, and push everything down onto a second page. Does PHPWord have a way to count the number of pages, so I can raise an error if the number of pages exceeds one? 回答1: After pawing through the source,