Mathias Nilsson wrote:
and I'm not implying that itext is doing anything wrong. It's just that I
can't get it right.
Then you have to provide a standalone example that reproduces the
problem, just as I'm now providing you with an example mashed up from
two existing examples that works as expected.
br,
Bruno
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.draw.DottedLineSeparator;
public class DottedLineTest {
public static void main(String[] args) throws DocumentException,
IOException {
Document document = new Document(PageSize.A4, 50, 50, 150, 72);
PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("dottedlinetest.pdf"));
document.open();
Chunk separator = new Chunk(new DottedLineSeparator());
// two parts
Paragraph p1 = new Paragraph();
p1.add(new Chunk("Chapter 1"));
p1.add(separator);
p1.add(new Chunk("p 10"));
// 3 parts
Paragraph p2 = new Paragraph();
p2.add(new Chunk("Chapter 2"));
p2.add(separator);
p2.add(new Chunk("x"));
p2.add(separator);
p2.add(new Chunk("y"));
// line ends with separator
Paragraph p3 = new Paragraph();
p3.add(new Chunk("Chapter 3"));
p3.add(separator);
// line starts with a separator
Paragraph p4 = new Paragraph();
p4.add(separator);
p4.add(new Chunk("chapter 4"));
// line IS a separator
Paragraph p5 = new Paragraph();
p5.add(separator);
// line IS a separator + leading
Paragraph p6 = new Paragraph(40);
p6.add(separator);
document.add(p1);
document.add(p1);
document.add(p2);
document.add(p3);
document.add(p4);
document.add(p5);
document.add(p6);
PdfPCell cell = null;
PdfPTable mainTable = new PdfPTable(3);
cell = new PdfPCell();
cell.addElement(new Phrase("This is the first line"));
cell.addElement(new Phrase("This is the second line"));
cell.addElement(new Phrase("This is the third line"));
cell.setRowspan(2);
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("1a"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("2a"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("1b"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("2b"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("1c"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("2c"));
mainTable.addCell(cell);
cell = new PdfPCell();
cell.addElement(new Phrase("3c"));
mainTable.addCell(cell);
document.add(mainTable);
document.add(p1);
document.add(p1);
document.add(p2);
document.add(p3);
document.add(p4);
document.add(p5);
document.add(p6);
document.close();
}
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/