I'm writing a Java agent that outputs some text in rich text field:
StringBuffer sb = new StringBuffer();
for (String line : datalines) {
if (sb.length() + line.length()< 64000){
sb.append(line);
sb.append(' ');
} else {
// flush buffer
rt.appendText(sb.toString());
rt.addNewLine();
sb = new StringBuffer();
}
}
// write the rest of the buffer
rt.appendText(sb.toString());
rt.addNewLine();
However, if the text is long, in the end I'm not able to open the document in UI. With a message: "Document has too many paragraphs - it must be split into several documents".
I know that "too many paragraphs" is an old issue. I've seen on old forums a lot of suffering and some unhelpful advice. But how many is "too many"? I just counted that I'm writing 533 paragraphs. Is it too many? I agree that the paragraph size is not bad at all, and total size is some 34 Mb. But size-wise it's peanuts for RT. I've tried to cut paragraph at 30K size - the same problem.
Found a funny document on IBM site about this problem on 8.5.1: http://www-01.ibm.com/support/docview.wss?uid=swg1LO53879 that claims that APAR is "Closed as fixed if next." And yes, I'm running 9.0.1, in case they meant "fixed in the next release" or some such.
Any thoughts about how many is too many or what really is the limit we are hitting and how to estimate at least - when we approach "too many"? And what are the strategies. Apart from writing less.
Frankly I can just write N non-summary text fields in this case, or use an attachment, but my passion for RT does not let me really let this go.
If you have "only one paragraph", you are hitting one of the documented "Limits of Notes":
Maximum size of a single paragraph in a rich text field: 64KB
In that case, .addNewLine(1,true)
as suggested by PeterMmm is the solution.
Otherwise, "Document has too many paragraphs" occurs when Notes client runs out of memory while opening a very large document with a large number of Body fields.
The notes.ini parameter EDITOR_MEMORY_SCALE can be given a value from 20 to 200 (for example, EDITOR_MEMORY_SCALE=200). A setting of 200 will use twice the amount of memory per document, and will slow performance, but will allow you to open a document returning the "Document has too many paragraphs..." error.
Source: