Let's talk pPr
Look, I know that many of you have been messing with WordProcessingML (WordML) since beta, but I have not. I just didn’t have time. I needed to figure out smart document technology (see this article on smart docs: https://msdn.microsoft.com/library/en-us/dnofftalk/html/office09042003.asp) and other things.
Now that I am into it, I am loving it more and more. I started with a really simple stylesheet to produce a word doc from a custom XML file, and now I am adding more sophisticated formatting to the document. This requires the powerful, the mighty, the underappreciated pPr element! The pPr element lets you define the properties for a paragraph. I’ll show some basic examples to keep it clear. Per esempio, if you want to have some text in a paragraph that will be Heading 3 style, then put it in the pPr. Here is part of my stylesheet with this instruction:
<xsl:template match="SummaryInfo">
<w:p><w:pPr><w:pStyle w:val="Heading3"/></w:pPr>
<w:r>
<w:t>
<xsl:value-of select="."/>
</w:t>
</w:r>
</w:p>
</xsl:template>
This is a really simple example, but what if I wanted to make things a little more interesting? [and, I do]. Here, I change the font color for some text:
<w:rPr>
<w:b w:val="off"/>
<w:color w:val="3366FF"/>
</w:rPr>
<w:t> (Percent Complete= <xsl:value-of select="@PercentComplete"/>)</w:t>
In my next entry, I am going to spill some of the details on how I gen some tables with borders, shading, and more.
Rock on!
(BTW: In case anyone is wondering, I am not putting band names in my blog as a thinly veiled attempt to increase the findability of my blog- I just love rock and roll and can’t resist linking it to my work. I usually am listening to great tunes when writing: Today is Jet- Get Born. Really solid, right to the roots rock and roll! Yeah.)
Comments
- Anonymous
February 19, 2004
The comment has been removed