Hi,
I have problem with rtf file format. Problem is the following: I need to read rtf file and change some runs. Way I do that is:
public static void main(String argp[]) throws Exception
{
String source = "d:/rtf/test.rtf";
String target = "d:/rtf/new-test.rtf";
Document doc = new Document(source);
List runs = getDocumentRuns(doc);
for (Run run: runs)
{
run.setText("New_ " + run.getText());
}
doc.save(target);
}
private static List getDocumentRuns(Document doc) throws Exception
{
final List runs = new ArrayList();
doc.accept(new DocumentVisitor()
{
@Override
public int visitRun(Run run) throws Exception
{
runs.add(run);
return super.visitRun(run);
}
});
return runs;
}
, but table in new-test.rtf is different then the source (test.rtf). It seems there is more then one table.
Can you please explain me what is problem.
Example file is in attachment.
Thanks,
Zeljko