0

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;

And then in the docx template have

[onshow.bulletPoint] which gets replaced with

• The rest of the string

But with the bullet point red in this case.

opm881
  • 3
  • 3

1 Answers1

0

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;.

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]

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.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • Hi, that seems to work except word is saying that the dot is an illegal character. I even made a new word docx, inserted the dot symbol, then unzipped the docx, grabbed the xml file and copied the dot directly from it and used that dot but it still says illegal xml character. The reference for where it is in the xml document that they state in the error message is the location of the first dot. – opm881 Sep 27 '13 at 06:39