Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <ul> <li><p>Please find the following points to write all types of utf-8 right to left data insertion in phpword template.</p> <ol> <li><p>In <code>setValue</code> function (line #95) in Template.php please comment the following portion of code</p> <pre><code>//if(!is_array($replace)) { // $replace = utf8_encode($replace); //} </code></pre></li> <li><p>If you have problem with right to left which in some language the text mix up with left to right text add the following code in the same <code>setValue</code> function.</p> <pre><code>$replace = "&lt;w:rPr&gt;&lt;w:rtl/&gt;&lt;/w:rPr&gt;".$replace; </code></pre></li> </ol></li> </ul> <p>//==== here is a working example of how the word data can be write inside the word template //--- load phpword libraries ----</p> <pre><code> $this-&gt;load-&gt;library("phpword/PHPWord"); $PHPWord = new PHPWord(); $document = $PHPWord-&gt;loadTemplate('./forms/data.docx'); $document-&gt;setValue('NAME', 'شراف الدين'); $document-&gt;setValue('SURNAME', 'مشرف'); $document-&gt;setValue('FNAME', 'ظهرالدين'); $document-&gt;setValue('MYVALUE', '15 / سنبله / 1363'); $document-&gt;setValue('PROVINCE', 'سمنگان'); $document-&gt;setValue('DNAME', 'عبدالله'); $document-&gt;setValue('DMOBILE', '0775060701'); $document-&gt;setValue('BOX','&lt;w:sym w:font="Wingdings" w:char="F06F"/&gt;'); $document-&gt;setValue('NO','&lt;w:sym w:font="Wingdings" w:char="F06F"/&gt;'); //$document-&gt;setValue('BOX2','&lt;w:sectPr w:rsidR="00000000"&gt;&lt;w:pgSz w:w="12240" w:h="15840"/&gt;&lt;w:pgMar w:top="1440" w:right="1440" w:bottom="1440" w:left="1440" w:header="720" w:footer="720" w:gutter="0"/&gt;&lt;w:cols w:space="720"/&gt;&lt;w:docGrid w:linePitch="360"/&gt;'); $document-&gt;setValue('YES','&lt;w:sym w:font="Wingdings" w:char="F0FE"/&gt;'); $document-&gt;setValue('CLASS1','&lt;w:sym w:font="Wingdings" w:char="F06F"/&gt;'); $document-&gt;setValue('CLASS2','&lt;w:sym w:font="Wingdings" w:char="F0FE"/&gt;'); $document-&gt;setValue('DNAME','يما شاه رخي'); $document-&gt;setValue('TEL','0799852369'); $document-&gt;setValue('ENTITY','مشاور حقوقي و نهادي'); $document-&gt;setValue('ENTITY','مشاور حقوقي و نهادي'); $document-&gt;setValue('REMARKS','در مسابقات سال 2012 میلادی در میدان Judo بر علاوه به تعداد 39 نفر در تاریخ 4/میزان/ سال 1391 قرار ذیل اند.'); $file = "./forms/data2.docx"; $document-&gt;save($file); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Disposition: attachment; filename=data2.docx"); header("Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document"); header("Content-Transfer-Encoding: binary"); ob_clean(); flush(); readfile($file); </code></pre> <p>//need how design can change the looking. colr #E4EDF9<img src="https://i.stack.imgur.com/X7yKk.png" alt="enter image description here"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload