phpword

Symfony2 PHPWord response

ぐ巨炮叔叔 提交于 2019-12-12 03:35:35
问题 I am trying to generate a docx document on Symfony2, using the PHPWord bundle. In my controller, I succeed in returning a docx file, but it is empty, I think it comes from my faulty response format. public function indexAction($id) { $PHPWord = new PHPWord(); $section = $PHPWord->addSection(); $section->addText(htmlspecialchars( '"Learn from yesterday, live for today, hope for tomorrow. ' . 'The important thing is not to stop questioning." ' . '(Albert Einstein)' )); // Saving the document

How to change styleTable on PHPWord?

天大地大妈咪最大 提交于 2019-12-12 02:39:42
问题 I have a problem with using the plugin phpword. I'm trying to change the style, but I can change the background of the cell and other parameters are considered by it. $styleTable = array('borderColor'=>'006699', 'borderSize'=>6, 'cellMargin'=>50, 'valign'=>'center' ); $styleFirstRow = array('bgColor'=>'6086B8', 'color'=>'white', 'bold'=>true, 'size'=>11, 'valign'=>'center' ); $PHPWord->addTableStyle('myTable', $styleTable, $styleFirstRow); If you want to look my code, he as here : http:/

reuse template in the same document [PHPword]

梦想与她 提交于 2019-12-11 10:17:56
问题 I am using PHPWord as a library in My Codeigniter Project. In my project, I want to generate a .docx file that uses a template which is already working. In that template is a Sticker that will be filled up by querying the data from the database. Since I want to generate multiple stickers in one document, I have to copy the first template that I have already used and add a pagebreak. But it is not working. I can't open the document. It says, "problem with its content" . I have here my working

Bolding, spacing and indenting text in phpWord

社会主义新天地 提交于 2019-12-11 05:48:41
问题 I have some text that I want bold, separated from previous and subsequent paragraphs, and indented. I can't get all three properties to work together. This works for bold and spaced: $section = $phpWord->addSection(); $section->addText( 'Re: Your Application for Post of Security Guard', array('bold' => true), array('space' => array('before' => 360, 'after' => 280)) ); and this works for indented: $section = $phpWord->addSection(); $section->addText( 'Re: Your Application for Post of Security

Save Generated File to database PHPWORD

為{幸葍}努か 提交于 2019-12-11 04:58:35
问题 I'm new with php Programming, I would like to ask if it is possible to save the generated files directly to database if you are using PHP word? $xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); $xmlWriter ->save("php://output"); Do I need to change the this lines? And I am using php5, mysqli 回答1: No it isn't possible to save the PHPWord object directly to a database; you can save it to any of PHP's streams, whether that is a file on the server, or to the output

Align two logos in same line in php word

只谈情不闲聊 提交于 2019-12-11 01:14:21
问题 I added two logos using php word but both logos are not on the same line: I want both logos to be on the same line like below: Where's my mistake? if (file_exists($logo)) { $table->addRow(); // $table->addCell(20000, array('bgColor' => 'ffffff', 'spaceBefore' => 0, 'spaceAfter' => 0, 'spacing' => 0), $fontStyleIndexParaTitle)->addImage($logo, array('align' => 'center')); $table->addCell(20000, array('bgColor' => 'ffffff', 'spaceBefore' => 0, 'spaceAfter' => 0, 'spacing' => 0 ),

How to duplicate variables into template with phpWord and using cloneBlock

此生再无相见时 提交于 2019-12-11 01:09:25
问题 Using phpWord in my application, I try to clone a block in the template like this : ${CLONEME} <br> You may also notice that there’s one text break (empty paragraph) before this one that can be created also by PHPWord ${item}" <br> ${/CLONEME} Doing this in my php code : $document->cloneBlock('CLONEME', 2} I obtain : " You may also notice that there’s one text break (empty paragraph) before this one that can be created also by PHPWord ${item} You may also notice that there’s one text break

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

a 夏天 提交于 2019-12-10 13:54:07
问题 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 File $h2d_file_uri = tempnam( "", "htd" ); $objWriter = PHPWord_IOFactory::createWriter( $phpword_object, "Word2007" ); $objWriter->save( $filename ); // At this line, I would like to output the file to the browser Anyone knows of how I can output

how to populate data in mysql

拟墨画扇 提交于 2019-12-10 10:45:19
问题 usually when i run this query it would always fetch all of the data in the table. but now its just taking a row of the data in the table. Im trying to export the data to Microsoft Wor by using phpword. how to solve this? $order_query = mysql_query("SELECT COUNT(id), BuyerName,BuyerEmail,BuyerAddress,TransactionID,ItemAmount,DateTime FROM `order`") or die(mysql_error()); $x= 0; $y= 0; // Add table while($row = mysql_fetch_array($order_query)) { $x++; $y++; // Add table style $PHPWord-

How to remove section pagebreak in PHPWord

不想你离开。 提交于 2019-12-10 10:39:40
问题 I am using PHPWord to create report. When I am creating a section it automatically adding a page break which I donot want. Is there any way to remove the added page break? or Is there any way to createSection without the page break? Please note that I am not using any template. Just creating a doc file from database with tables and images. Thanks. 回答1: You can define how the page breaks behave with the section breakType style. To remove the page breaks completely from the sections just use