在openTBS中插入要点并设置样式以显示[onshow.]整体 [英] Inserting a bullet point and styling to [onshow.] entires in openTBS

查看:89
本文介绍了在openTBS中插入要点并设置样式以显示[onshow.]整体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种方法可以通过onshow应用的变量来传递项目符号点和基本的CSS颜色样式.IE浏览器

I was wondering if there was a way to pass through a bullet point and a basic CSS colour styling for the bullet point via the variable that gets applied via onshow. IE

$string = '<span style="color:red">&#149;</span> The rest of the string';
$TBS -> VarRef['bulletPoint'] = $string;

然后在docx模板中拥有

And then in the docx template have

[onshow.bulletPoint]替换为

[onshow.bulletPoint] which gets replaced with

•字符串的其余部分

但是在这种情况下,项目符号要用红色表示.

But with the bullet point red in this case.

推荐答案

对于项目符号,可以使用UTF8通用字符.OpenXML似乎无法识别所有HTML特殊字符,例如&#149 ;.或& bull; .

For the bullet, you can use the UTF8 common character. OpenXML seems to not recognizes all the HTML special chards such as &#149; or &bull;.

所以剩下的问题是插入一个包含样式更改的字符串.由于在OpenXML中无法将样式应用于XML实体(例如在XML中),因此您必须对包含字符串的整个实体进行操作.它必须是,代表DOCX中的一部分文本(假设您的文档是DOCX).

So the remaining problem is to insert a string including a style change. Since in OpenXML styles cannot be applied inside an XML entity (such as in XML), then you have to operate on the entire entity that contains your string. It must be a which represent a portion of text in DOCX (assuming your document is a DOCX).

$string = "
      <w:r>
        <w:rPr>
          <w:color w:val="FF0000"/>
        </w:rPr>
        <w:t>•</w:t>
      </w:r>
      <w:r>
        <w:t xml:space="preserve"> The rest of the string</w:t>
      </w:r>";
$TBS->VarRef['bulletPoint'] = $string;

DOCX:

[onshow.bulletPoint;strconv=no;enlarge=w:r]

参数 strconv = no 使您可以不转换XML.使用参数 enlarge = w:r 可以扩展TBS字段的范围.这可能
包裹可能放置在同一< w:r> 实体中的其他一些文本.

Parameter strconv=no enables you to not convert the XML. Parameter enlarge=w:r enables you extend the bounds of the TBS field. This may
enwrap some other piece of text that may be placed in the same <w:r> entity.

这篇关于在openTBS中插入要点并设置样式以显示[onshow.]整体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆