Вопрос

I want add multiple line in one cell with openTBS, but <br/> to <w:br/> is not "real" multiple line. So I'm try to use <w:p>Text</w:p> or <w:p><w:r><w:t>Text</w:p></w:r></w:t>, but cann't open in ms word.

So how can I add multiple line in a variable?

Это было полезно?

Решение

If you are adding your tags inside of Word, your tag is going to be inside of a element already. You cannot nest another inside of a , so you will likely need to close some tags before you start and then open them again at the end. You will need to look at your xml to see what tags you need to break out of. You can see it by using

$TBS->Show(OPENTBS_DEBUG_XML);

In place of your Show() tag temporarily. Once you know how your tag is nested (inside <w:p><w:r><w:t>[onshow;data;]</w:t></w:r></w:p>, e.g.), you can break out by setting $data like this:

$data = '</w:t></w:r></w:p><w:p><w:r><w:t>Text</w:t></w:r></w:p><w:p><w:r><w:t>';

Keep in mind your tags need to nest properly, like <w:p><w:r><w:t>Text</w:t></w:r></w:p>, not like in your example <w:p><w:r><w:t>Text</w:p></w:r></w:t>.

Word is very fidgety about this stuff, but it is good about telling you where your problem is if you look. Have you tried changing your file extension from .docx to .zip and going into word/document.xml and looking at the line and column number Word gives you in the details of the error popup?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top