itextsharp中的pdfpCell.Rowspan无法正常工作 [英] pdfpCell.Rowspan in itextsharp not work properly

查看:699
本文介绍了itextsharp中的pdfpCell.Rowspan无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个具有以下结构的PDF!

I need to crate a PDF with following structure!

http://www.freeimagehosting.net/6auu8
(我的图片链接)

http://www.freeimagehosting.net/6auu8 (link of my image)

我的片段是......

my snippet was...

//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);

但是,它不起作用.....

but, it not working.....

推荐答案

试试这个:

Try this:

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();

这篇关于itextsharp中的pdfpCell.Rowspan无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆