I read the Javadoc for the Table class, which says: "Normally a newline is
added before you add a Table object. This newline uses the current leading.
If you want to control the space between the table and the previous element
yourself, you have to set the offset of this table. "
So this explains why there is an extra blank paragraph in the output. My
question: is there a way to remove the paragraph or to prevent its creation?
Or is there a way to add text to it? I need to add a title for the table, so
if I can use the extra paragraph for this purpose, the paragraph would no
longer be a problem.
Thanks!
Steve-O wrote:
>
> I have an app that creates an rtf file. The app inserts an extra pgf
> symbol on two occasions:
> -- When I insert a paragraph with a certain style
> -- When I insert a table.
> The extra pgf symbols are inserted directly above the paragraph and table.
>
> Following are the declarations and code i use to insert the paragraph with
> the problem style:
> RtfParagraphStyle tableTitleStyle = new RtfParagraphStyle("TableTitle",
> "Normal");
> tableTitleStyle.setSpacingBefore(12);
> tableTitleStyle.setSpacingAfter(3);
> tableTitleStyle.setFontName("Arial");
> tableTitleStyle.setSize(10f);
> tableTitleStyle.setStyle(RtfParagraphStyle.BOLD);
> writer2.getDocumentSettings().registerParagraphStyle(tableTitleStyle);
> rtfDocument.add(new Paragraph(srcClass.getName() + " Fields",
> tableTitleStyle));
>
> Following are declarations/code for inserting the problem table:
> Paragraph pgf = null;
> Cell cell = null;
> Table fieldsTable = new Table(3);
> fieldsTable.setAlignment(Table.ALIGN_LEFT);
> fieldsTable.setBorderWidth(1);
> fieldsTable.setPadding(5);
> fieldsTable.setSpacing(1);
> pgf = new Paragraph("Field Name", tableHeaderStyle);
> cell = new Cell(pgf);
> cell.setHeader(true);
> fieldsTable.addCell(cell);
> pgf = new Paragraph("Field Type", tableHeaderStyle);
> cell = new Cell(pgf);
> cell.setHeader(true);
> fieldsTable.addCell(cell);
> pgf = new Paragraph("Field Description", tableHeaderStyle);
> cell = new Cell(pgf);
> cell.setHeader(true);
> fieldsTable.addCell(cell);
> fieldsTable.endHeaders();
> rtfDocument.add(fieldsTable);
>
> Has anyone experienced this problem?
>
> Thanks,
> Steve
>
--
View this message in context:
http://www.nabble.com/Extra-Paragraph-Symbols-Inserted-tf4203054.html#a11983488
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/