/Users/lyon/j4p/src/futils/RtfUtil.java
|
1 package futils;
2
3 public class RtfUtil {
4 public static final String header =
5 "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033" +
6 "{\\fonttbl{\\f0\\fswiss\\fcharset0 Arial;}}" +
7 "\\viewkind4\\uc1\\pard\\f0\\fs20";
8
9 public static String getItalic(String s) {
10 return "{\\i " + s + "}";
11 }
12
13 public static String getBold(String s) {
14 return "{\\b " + s + "}";
15 }
16
17 public static String getPlain(String s) {
18 return "{ " + s + "}";
19 }
20
21 public static String getPara(String s) {
22 return "{ " + s + "\\par}";
23 }
24
25 public static String getTest() {
26 return header +
27 getPara(getItalic("this is italic")) +
28 getBold("this is bold") +
29 getPara("") +
30 "}";
31 }
32
33 public static void print(Object o) {
34 System.out.println(o);
35 }
36
37
38 public static void main(String args[]) {
39 print(getTest());
40 }
41
42 }