When last we left things I had a pretty simple function that could just accept a parameter and raw text for formatting in an RTF file.

So here is where things get kinda neat.   What if I wanted to do things like “Bulleting” or maybe a centered header.

Now I could (and you can do this if you’re more of a Developer) download the official "Word 2007: RTF Specification" from Microsoft on the RTF file language.  In truth if you get deeper into this, it’s a great guide to help you tweak in fonts, pitches and all sorts of neat stuff.

But again, I don’t have time for a lot of that.  I need it “here and now”.   So I found a neat trick.  It also happens to be the very same way I learned to see what I needed to make a BASIC RTF document.

First I opened up Wordpad (yes, it’s probably installed on your Server to this day unused) and saved the default document as test.rtf

I then opened up that file in Notepad and viewed the output. (Remember RTF *IS* just a text file)


I then added a simple line like “I love PowerShell” and then saved THAT as a second file called testline.rtf and opened THAT in Notepad to compare the difference


So in seeing the only thing that I needed to add was a PowerShell variable which could replace ‘I love PowerShell’ with whatever text I wanted for a simple line of text.

Now of course there is MORE involved.  If I were to read the content prior to the text it would actually be format, font codes and more details.  But REPEATING that as it stood would give me a clean line of RTF output.  

Remember as well this is a ‘v1’ solution, we can build and IMPROVE on our original thoughts later.

I then thought to myself “What if I want some bold and Centered output?”

So again, open up that blank Wordpad, type some text it, turn on Bolding and Centering on the content, then save the result as testtitle.rtf.   Again I opened the file to see the result.


“Cool!” I thought.   So to add the ability to spit out a Centered Title to our function from yesterday we only would need to two things. 

  1. Assign it a number for the “style”
  2. Build the string to hold the content.

Which in this particular scenario we’re going to use 999 as the number centered text and just populate one additional line to the switch statement in the previous function.

     ‘999’ { $Output=”pardsa200sl276slmult1qculbf0fs22lang9 “+$Content+”ulnoneb0par” }

Neat eh?

Open up Wordpad for yourself and try making some formats to add in Bulleted text in the same way.  It’s a LITTLE trickier but not impossible.

Stay tuned tomorrow when I’ll show you how to do something Wordpad can’t NATIVELY create but it DOES support on viewing.   TABLES!


the EnergizedTech