TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dev 0
NA
31
36k
How to set widths of column of pdfptable same as database column using itextsharp
Sep 27 2011 3:28 AM
Hi
I am doing code in C#.
I have created table using itextsharp, and binding my table with database,
so at every time i have no any idea about how many columns.
and i want my table in which column width is adjustable as par my data which is coming from database.
In below code ,if and only if, i know how much columns are their (in below case i.e 2 columns) so i used 2 width here ,
Collapse
|
Copy Code
PdfPTable pdfTable = new PdfPTable(table.Columns.Count);
iTextSharp.text.Rectangle rect = PageSize.LETTER;
float pageWidth = rect.Width;
if (pdfTable != null)
{
pdfTable.SetWidthPercentage(
new float[] {
(float).15 * pageWidth ,
(float).15 * pageWidth,
}, rect);
}
but when we have no any idea about number of columns(i.e when i binding pdfptable with my database) ,i can get count of columns , but how to set widths to each column widths as per data from database.
so plz help me.
Reply
Answers (
0
)
Need to read the <ul> values from aspx page
What is the difference between the Implicit and Explicit Calling?