-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Insert bold text into tamplates #750
Comments
If you need only bold text in the middle of plain text you can dirty hack this in TemplateProcessor. And add to your text tag Even better put this code into setValue method. |
Same trick but a little wider And mark your code as Additionally you can use I and U markers. Bt of course some kind of system solutin would be better. |
@pv451
In which plase i need to insert your fix-code? |
Actually i corrected myself, and said that setValue would be better place
|
@pv451 My fuctions:
I try to change my "setValue" function by yours. But I have an err in my word document - the document is damaged. I try to insert 2 rows (see below) into setValueForPart and setValue
But my document damaged. So, wat can I do? Perhaps you can send me yours TemplateProcessor.php file? |
I accidentally closed the discussion. |
Yep. it's diffrent functions in my class too. |
I use special version fore php7 (there was a problem with String, because 'String' is a special class name) So your file is not fore my( |
Actually if you diff them there not so many changes. I mean replace it in my file. |
@pv451
to
php work. But I have bad docx file - the document is damaged. |
@pv451
in word document test.docx I insert ${st} |
Attach your modified templateprocessor |
@pv451 |
You are using second version of my "patch" use |
@pv451 |
Try develop branch. As I see there is no issue with String or SharedString. It replaced with |
Yep, it seems that develop branch can only be installed over composer. |
@pv451 So, i replace my code to yours and it is work!) Thank you very much!!! |
@pv451
I expect: But I have next text without spaces: How can I fix it? |
static public function b($str, $hex=null, $style=''){ Maybe this helps you. |
Can we change fonts like this? |
How I solved it: PhpWord/TemplateProcessor.php And finally
|
So, I need to do the following:
I have a docx tamplate with table. I "cloneRow" her. And insert in cells data from mysql database (DB). And I need insert this data with some bold pieces. In the DB I keep the text without formatting, but I can insert some marks like ${bold}. BUT I need to do bold not all text.
For example, I have in my DB the following:
Some text in my database
And I need insert in template the following:
Some text in my database
In DB I can store text with marks, but how to do bold marked text? And what kind marks to use?
Help me please. It is very important for me!
The text was updated successfully, but these errors were encountered: