Hi,
i am creating a document with justified text and adding multiple paragraph in one string.
when the last line of the para dose not contain enough word to fill the line it spreads the words with large space in between
i same can be done by shift enter in word.
which property should i use to solve this.
Hi,
Paragraph
para = new Paragraph(doc);<o:p></o:p>
// We can set some formatting for the paragraph
para.getParagraphFormat().setStyleName("Heading 1");
para.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
For more details, please visit following links:
Hope this will help you.
Hi,
hi
i am using this code
String clauseText = getFormattedClauseText(clause.getClauseText());
clauseText = clauseText + “\r”;
builder.getParagraphFormat().setStyle(listStyleLevel1);
// builder.getListFormat().setList(list);
builder.getListFormat().setListLevelNumber(2);
builder.getFont().setSize(12);
builder.getFont().setName(“Calibri”);
builder.getFont().setBold(false);
builder.getParagraphFormat().setAlignment(ParagraphAlignment.JUSTIFY);
builder.getParagraphFormat().setLeftIndent(0);
builder.writeln(clauseText);
builder.getFont().clearFormatting();
builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.NORMAL);
I am generating a document like this.
using the above code in loop
see the text is between the para is spread across the line.
Hi,
Document doc = new Document("d:/temp/doctest.doc");
// Iterate through all paragraphs in the document
for (Run run : (Iterable<Run>) doc.getChildNodes(NodeType.RUN, true))
{
String RunNodeText = run.getText();
// Removing multiple Tabs
RunNodeText = RunNodeText.replaceAll(ControlChar.TAB, " ");
// Removing Line Breaks
RunNodeText = RunNodeText.replaceAll(ControlChar.LINE_BREAK, " ");
// Removing multiple white spaces
Pattern r1 = Pattern.compile("[ ]{2,}");
Matcher m1 = r1.matcher(RunNodeText);
RunNodeText = m1.replaceAll(" ");
run.setText(RunNodeText);
}
doc.save("d:/temp/doctestOut10.doc");
I have attached output Word document file. Hope this will help you. In case of any ambiguity, please let me know.