By: Martin Koeditz
Date: 2014-04-09
Time: 15:35
|
Format textHello,
is there a way to format text via PHP? I'd like to have some text parts formatted italic and red font color. Kind regards, Martin |
|||
By: Skrol29
Date: 2014-04-10
Time: 01:32
|
Re: Format textHi,
You can insert XML content and prevent it from being converted. But this is nor simple because in ODT the formating is defined using styles. So the best is to define your own named character style in the ODT. Then you can use a TBS field with paramtere "att" in order to chnage the style name of the text snippet. The inner XML with character style is like this:
So the TBS can be like this:
|
|||
By: Martin Koeditz
Date: 2014-04-10
Time: 09:03
|
Re: Format textThank you for the reply.
I've created a paragraph style named 'Historisch' in the odt. The part to be replaced looks like this:
Now I fill the placeholder via PHP:
Unfortunately I get this result:
What am I doing wrong? |
|||
By: Skrol29
Date: 2014-04-10
Time: 10:57
|
Re: Format text
|
|||
By: Martin Koeditz
Date: 2014-04-10
Time: 15:26
|
Re: Format textOK, I changed the the expression in the template, but now the text is gone. Just white background.
Template: http://www.it-syn.de/tmp/template.odt Result file: http://www.it-syn.de/tmp/output.odt At the end of the page there is the section
Maybe it's just a simple mistake? |
|||
By: Skrol29
Date: 2014-04-10
Time: 18:47
|
Re: Format textThe fields is correctly merged, as we can see in the inner XML.
But your text cannot be displayed by LibreOffice because <text:h> cannot be placed into <text:p>. If you replace <text:h> with <text:span> then it works. |
|||
By: Martin Koeditz
Date: 2014-04-10
Time: 21:29
|
Re: Format textThank you so much. It's working now.
|