Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

c# - How to set the cell width in itextsharp pdf creation

How can I set cell width and height in itextsharp pdf cell ceration using c#. I just use

cell.width = 200f;

But it should display the error message.

width can not be set.

What should I do?..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You don't set the width of a cell.

you should set the width of the columns. And you can do that by applying them on the table object:

float[] widths = new float[] { 1f, 2f };
table.SetWidths(widths);

The answer from Neha is to set the width of the table object

more reference material here: http://www.mikesdotnetting.com/Article/86/iTextSharp-Introducing-Tables


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...