WordPad Numbering Limit

In Windows 7, WordPad has undergone many improvements even though it uses RichEdit 4.1+ for editing and display. Time and time again, the excellent Hyderabad team responsible for enhancing the Windows 7 WordPad requested very reasonable extensions to RichEdit 4.1, extensions that have been included in later versions of RichEdit. They’ve also requested features that aren’t in the latest RichEdit (7.0) which ships with Office 2010, but that’s another story. One of their many requests has to do with limiting numbered paragraphs to a maximum number of 255. Why not 1000 or 10000? The reason for the small numbering maximum is that RichEdit 4.1 doesn’t cache paragraph number offsets and calculating the offsets on the fly can require substantial execution time. Without the limit, the RichEdit team had bugs claiming that RichEdit was literally hanging. Interestingly enough, later versions of RichEdit don’t have this limit. Let’s see why.


When the original OneNote was created in the Office 2003 time frame, it used RichEdit 5.0 and needed some special Page/Table Services (PTS) features.  PTS is a component library complementing LineServices. PTS is responsible for laying out pages and tables, whereas LineServices is responsible for laying out individual lines. PTS requires “names” for each paragraph (soft or hard), so Sasha Gil of the RichEdit team added special “NMP” runs for the purpose. Fortuitously, this run infrastructure provides a convenient place to cache paragraph number offsets and allowed us to remove RichEdit’s numbering maximum of 255.


Ironically OneNote has always handled paragraph numbering itself, but nevertheless RichEdit numbering has benefitted by OneNote’s need for PTS. Bidirectional (BiDi) layout involving Hebrew and/or Arabic text and math processing also benefit since the NMP runs greatly speed up paragraph boundary navigation. In fact RichEdit 6.0 and later versions automatically enable NMP runs whenever numbered paragraphs, BiDi and/or math are present in a document even if PTS itself isn’t enabled.


A footnote to this saga is some sage advice given to me by Eliyezer Kohen, the leader of the original teams that developed Microsoft’s TrueType implementation, the OpenType specification, LineServices, and PTS. I was designing and implementing RichEdit’s binary format for, you guessed it, the first version of OneNote (OneNote 2010 has switched to a different format). Eliyezer strongly recommended that RichEdit’s binary format tag paragraph boundaries explicitly, even though RichEdit didn’t formally need such tagging. He was absolutely right. From both structural and performance standpoints, knowledge of paragraph boundaries is very valuable in text editing and display.


Comments (5)

  1. anonymuos says:

    Minor Correction: Office 2003. And I’m disappointed there’s no spell check with red underline in WordPad. Maybe Windows 7 Service Pack 1.

  2. MurrayS says:

    Yes, OneNote was developed in the Office 2003 timeframe. RichEdit 4.0 was developed for Office 2002. Thanks for the correction (which I have made to the post). Spell checking involves dictionaries and I guess these only come with more elaborate applications. But good point too.

  3. consumer4beta@hotmail.com says:

    "requested reasonable extensions" meaning what? The management deliberately keeps WordPad crippled (no spell check) to ensure Word sales? Or is that for compatibility? WordPad needs to be like Microsoft WORKS Word Processor and Word as the full-fledged editor in Office.

  4. Francis says:

    Well, MS could do with WordPad what Outlook Express did–enable spell-checking if a dictionary is installed, e.g. by Office. Doesn’t the free Windows Live Mail, by the way, include a spell checker? (…so why not WordPad?)

  5. Nali says:


    please, is there any way, how to use OMML equation in Wordpad in Windows 7? The presentation "Math Editing and Display in Word 2007" describes how to use WordPad to enter math formulas, but it seems it is disabled in Win7.

    Thank you.