Quantcast
Channel: PHPWord
Viewing all 450 articles
Browse latest View live

New Post: setValue and line breaks

$
0
0
Hi everyone,

First I would like thank you guys for the incredible work you have done with this framework !
My question is how I do a line break into a setValue ?

In my document, I have something like that :
${Value1}

And I want it to become something like this :
First sentence
Second sentence

But it's just a line break, not an array and the string would be "First sentence<br/>Second sentence" or something like that.

Maybe it's not possible yet but if someone has a solution, it would be nice !
Thanks !

New Post: setValue and line breaks

Created Unassigned: phpword is not working with .doc extension [79]

$
0
0
Is phpword not supporting for .doc instead of .docx extension? Can anybody help me for the .doc extension. It is pretty working for docx but not working for .doc

Created Unassigned: Codeigniter integer [80]

$
0
0
how can i integer phpword with codeigniter as a library ??

Reviewed: PHPWord 0.6.2-1 Beta (Jul 17, 2014)

$
0
0
Rated 5 Stars (out of 5) - Super....and Duper

New Post: How can we add a horizontal rule inside docx file

$
0
0
Hey, Even i'm facing the same issue, I tried to search a lot in the documentation and also in google but found nothing, please anyone provide a tweak for doing this.
or else i might need to develop my project again in another word library.

Thanks in Advance

New Post: get page number

$
0
0
dear all, I am wondering if there are some methods i can get the current page number of the word document, thank you in advance.

New Post: Generating html and Docx at the same time

$
0
0
Hello there.

I want to be able to generate a docx document and an html preview of the document at the same time, with the same code for sustainability purpose.

The generated docx document works well. However, when I generate html from it doesn't put any class inside the html lines, just the css.

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
$objWriter->save('CRR.html');

Do I have to add the classes manually inside my text or can I do it by using the addText() argument?

New Post: TOC not working?

$
0
0
wanglei_estar, this worked for me:
$objWriter->startElement('w:r');
       $objWriter->startElement('w:t');
               $objWriter->writeRaw($i+2);
       $objWriter->endElement();
$objWriter->endElement();
//end 
thanks

New Post: How can we add a horizontal rule inside docx file

$
0
0
if it is for print that you can use css to turn the lines and use print of the chrome but if it is for creat a word file i'm thinking that maybe the only way is put the string
in array then count the position of all words..... i'm still thinking other ways


thanks

New Post: Table Align

$
0
0
how to align table in the center of the page?

New Post: Template setValue with caractère "&" - File corrupt

$
0
0
Hi,
I'm developping a web page in which the users can download a word file.
I'm trying to do this with PHPWord. But the file .docx that outputs from the page is corrupt and I can't open it. The problème is the caractere "&".
Here's the script:

require_once 'PHPWord.php';
$PHPWord = new PHPWord();

$template = $PHPWord->loadTemplate('Client.docx');
$client = "Ben&Nuts";
$template->setValue('CLIENTE', $cliente);
$template->save('Client.docx');

Why and how resolve it ?

Thank for the response.

New Comment on "Documentation"

$
0
0
error over : $myTextElement = $section->addText('Hello World!'); $myTextElement->setBold(); $myTextElement->setName('Verdana'); $myTextElement->setSize(22); object(PHPWord_Section_Text)[84] private '_text' => string 'Hello World!' (length=12) private '_styleFont' => null private '_styleParagraph' => null setter setBold(),..; are undifined

New Post: SetValue and Space

$
0
0
Dears,

I'm trying to use SetValue to replace a string with one or double spaces, for example:
$vazio = "  ";
$document->setValue('EXAMPLE', $vazio);
But, in the Word file it generates a null char.
For example:
(${example})
It should be:
(  )
Although, it generates:
()
Anyone capable of helping me?

Thanks :)

BTW, I had to use a "fix" for template.php from phpword, because it was not replacing anything (I think it was generating a wrong XML file and PHPWord couldn't find the necessary string to replace):
public function setValue($search, $replace) {
        if(substr($search, 0, 2) !== '${' && substr($search, -1) !== '}') {
            $search = '${'.$search.'}';
        }
        
        preg_match_all('/\$[^\$]+?}/', $this->_documentXML, $matches);
        
        for ($i=0;$i<count($matches[0]);$i++){

        $matches_new[$i] = preg_replace('/(<[^<]+?>)/','', $matches[0][$i]);
        
        $this->_documentXML = str_replace($matches[0][$i], $matches_new[$i], $this->_documentXML);
        }


                
        
    $this->_documentXML = str_replace($search, $replace, $this->_documentXML);
        
        
        
    }

New Post: Is it possible to convert doc to docx?

$
0
0
cindydolan's answer will not work because the loadTemplate uses xml and which is contained in docx file and not doc file.

Cindydolan I suggest you test code before posting it.

Any working ideas?

New Post: Table Align

$
0
0
ADD in function _writeTable (base.php) this:
$objWriter->startElement('w:tblpPr');
$objWriter->writeAttribute("w:tblpXSpec","center");
 $objWriter->endElement();
RESOLVED!

New Comment on "Documentation"

$
0
0
Its work good but sometime i have problem with some special characters like &,$ etc.. and is there any way to read and write doc file ??

New Post: Is it possible to convert doc to docx?

$
0
0
Hi i was tried much but it was not working working there was blank docx file created..

New Post: What is the correct syntax of using page size command

$
0
0
Good jillelaine, it works fine. But that size in milimeter, pixel or others? and how about set to general size such as F4, A4 etc?

New Post: What is the correct syntax of using page size command

$
0
0
"Twip" is a unit of measurement equal to 1/20th of a printers point. There are 1440 twips to and inch, 567 twips to a centimeter. http://support.microsoft.com/kb/76388

You should also check out the phpWord development on github:

They have added the ability to use measurement unit other than twips with setMeasurementUnit, thanks to ivanlanin, and many other features and bugfixes. https://github.com/PHPOffice/PHPWord/
Viewing all 450 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>