Search code examples
c#rtf

Is there an issue with this RTF sample?


I am doing an override of RichTextBox to tell it to use the newest RTF assembly available. I have RTF which displays well in MS word. The same RTF is mal-aligned in a table when viewed in my custom RichTextBox.

Example

enter image description here

Is there any issue with this RTF formatting that will cause this to occur?

{\rtf1\ansi\deff0{\fonttbl{\f0 Arial;}{\f1 Courier New;}}\viewkind4\uc1\pard\lang1033\f0\fs20 
{\pard\f0\ul\b Fingerstick Glucose\b0 : Collected: 8/29/2012 5:44:00 AM\ulnon\f0\par}
\par\pard\lang1033\f0\fs20 
{\trowd
\cellx4000
\cellx9500
 Fingerstick Glucose\intbl\cell
 125 mg/dL\intbl\cell
\row}

}

UPDATE

This greatly simplified RTF has the same issue. "cell 1" floats above and out of the table.

{\rtf1\ansi\deff0
\trowd
\cellx1000
\cellx2000
\cellx3000
cell 1\intbl\cell
cell 2\intbl\cell
cell 3\intbl\cell
\row
} 

Solution

  • \intbl needs to come before the text.

    {\rtf1\ansi\deff0 
    \trowd 
    \cellx1000 
    \cellx2000 
    \cellx3000 
    \intbl cell 1\cell 
    \intbl cell 2\cell 
    \intbl cell 3\cell 
    \row 
    }