if(doc == null) return;
if(groupLevel<0) groupLevel = 0;
char[] a; Arrays.fill(a= new char[groupLevel*2], ' ');
String spaces= new String(a);
if(doc instanceof RtfDocument) {
((RtfDocument)doc).add(new RtfDirectContent("\n" + spaces + str));
}
else
if(doc instanceof LwgDocument) {
try {
((LwgDocument)doc).add(new RtfDirectContent("\n" + spaces + str));
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}