| Author |
replace a String in an RTF file AND change the font
|
Rod McLure
Greenhorn
Joined: Mar 04, 2010
Posts: 24
|
|
I am replacing a "template" String with rows of strings from an array see below to give the appearance of a table, I am including tabs in the replaced strings
stringBuf1.append("\t");
stringBuf1.append(line1String[0]);
replace string $$table_data$$ with below
but things are not lining up in my output file.( Chapter 11 should appear under 680)
Offence no 3 680 Pisquid 29/7/2010
4 Chapter 11 Iris 7/7/2010
I think the problem is the font in the template is not Courier(where every character is the same size)
Does anyone know what "codes" I could append to the String to make the font Courier, and what code would change it back later?
I know this is not a java question but I don't know where else to go with it.
Thanks
|
 |
Rod McLure
Greenhorn
Joined: Mar 04, 2010
Posts: 24
|
|
was able to use tables instead.
example rtf
{\rtf1\ansi\deff0 {\fonttbl {\f0 Courier;}}
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}
<---------add this using java
{\pard
\trowd\trgaph300\trleft400\cellx2880\cellx5360\cellx8640\cellx10080
\pard\intbl The\cell
\pard\intbl quick\cell
\pard\intbl brown\cell
\pard\intbl brown\cell
\row
\trowd\trgaph300\trleft400\cellx2880\cellx5360\cellx8640\cellx10080
\pard\intbl fox\cell
\pard\intbl jumped\cell
\pard\intbl over the lazy\cell
\pard\intbl over the lazy\cell
\row
\trowd\trgaph300\trleft400\cellx2880\cellx5360\cellx8640\cellx10080
\pard\intbl dog\cell
\pard\intbl bog\cell
\pard\intbl log\cell
\pard\intbl log\cell
\pard\intbl log\cell
\row
}
|
 |
 |
|
|
subject: replace a String in an RTF file AND change the font
|
|
|