OpenOffice, RTF files, “fields”, and the irritating RTF keyword “MERGEFIELD”

Once a year my accountants send me RTF files (“.rtf”) with “fields“. “fields” have “names” and “values“.

Microsoft Office (presumably) deals properly with displaying and printing the field values.

On OS X “textedit” can also read RTF files, and properly displays the field values. But it’s not fun to use “textedit” for more than displaying (multi-page) documents on the screen.

OpenOffice (e.g. on OS X) reads RTF files properly (?), and it displays the field names – but it does not successfully display the field values. Usually you switch with “View / Field Names” between displaying field names and field values, but for RTF files, this only switches between

  • displaying the fields like this: <fieldname>
  • and like this: fieldname..

It looks, like that’s a well-known problem resp. issue in the OpenOffice community, but apparently there is not enough interest in solving that issue.

So how to print an RTF document with fields using OpenOffice? The dull approach (dull but straight forward): Replace the fields with their values manually!

More details and more sophisticated approach …

OpenOffice knows how to deal with the “simple” RTF construct: “field fldinst fldrslt“, that is being used for page numbers; but OpenOffice fails for this more complicated RTF construct: “field fldinst MERGEFIELD fldrslt“. I tried a few things, and I found out, that simply removing “MERGEFIELD” from the RTF code solved the issue for me.

How to edit an RTF document as text file? E.g. like this: Rename the file by appending “.txt”, open the document with a simple text editor,  (do the replacements …), rename it back to the original name. Now try it in OpenOffice! Switching back and forth (field names vs. field values) now works properly, and you will be able to print the document using the field values.

This site uses Akismet to reduce spam. Learn how your comment data is processed.