Set the font style for an RTF document

Cannot set the text font style as Times New Roman for this document. I want all the tests to have a new roman size 10. I created a font table that contains the type and its only type of my document. I want all the text to be the time of the new roman, but whenever a document is created, it says that it is damaged for some reason, but if I do not set the font style, the doc exits the default cursor and does not damage it.

{\fonttbl{\f1\froman\fprq0\fcharset0 Times New Roman;} \par Hi <#name#> \par\par Welcome to New York \par\par \b New iPad\'ae App Is Available \b0 \par These are all the exciting things you cna do during your stay. \par \par } 
+4
source share
1 answer

You are missing a lot of formatting in your example. For example, save a very simple RTF file from Wordpad or another application (Word puts too much metadata) and sees everything that you are missing.

First, Here is the latest RTF Spec, 1.9.1 . This will help you work with any related RTF.

Secondly, any RTF document should start with \rtf*N* , where N is the version of RTF (currently 1). You are missing this in your example. This is one of many reasons why it says the file is corrupt.

Thirdly, you define something in the font table, and then do not use the definition of f1 . This is an old specification for RTF, 1.6, but look at how the font table is defined.

There are many other things, but I think you are using RTF, as if you were using HTML or something with tags. I would like to read in the specification to see how RTF works. Here is a very small RTF document:

  {\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2 {\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Tahoma;}} {\colortbl\red0\green0\blue0;\red255\green255\blue255;} \loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs16\f2\cf0 \cf0\ql {\f2 {\ltrch This is a test of RTF.}\li0\ri0\sa0\sb0\fi0\ql\par}}} 
+2
source

All Articles