我需要创建一个具有以下结构的PDF!
http://www.freeimagehosting.net/6auu8 (我的形象的链接)
我的片段是......
//Create new Pdfptable
PdfPTable table = new PdfPTable(4);
// create new cell
PdfPCell LEFT= new PdfPCell(new Phrase("Left"));
LEFT.Colspan = 1;
LEFT.Rowspan = 2;
table.AddCell(LEFT);
// create another cell
PdfPCell RIGHT= new PdfPCell(new Phrase("Right"));
RIGHT.Colspan = 3;
RIGHT.Rowspan = 2;
table.AddCell(RIGHT);
但是,它不起作用.....
答案 0 :(得分:0)
试试这个:
Document document = new Document();
PdfWriter.GetInstance(document, new FileStream("c:\\Chap0501.pdf", FileMode.Create));
PdfPTable table = new PdfPTable(4);
document.Open();
PdfPCell LEFT = new PdfPCell(new Phrase("Left"));
LEFT.Colspan = 1;
LEFT.Rowspan = 2;
table.AddCell(LEFT);
PdfPCell RIGHT = new PdfPCell(new Phrase("Right"));
RIGHT.Colspan = 3;
RIGHT.Rowspan = 2;
table.AddCell(RIGHT);
document.Add(table);
document.Close();