Click here to Skip to main content
15,887,477 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to place cells vertically in table. Normally, it is placed as follows: https://imgur.com/a/EPTqobR

But I want to this: https://imgur.com/a/hrDz2aZ

That way, I'm gonna put 10 contents in the cells. Waiting for your helps.

What I have tried:

C#
PdfPTable table = new PdfPTable(2);

table.AddCell("content 1");

table.AddCell("content 2");

table.AddCell("content 3");

table.AddCell("content 4");

document.Add(table);
Posted
Updated 11-Apr-23 21:38pm

You are creating a table with two columns, so the data will fill the cells left to right and then top to bottom. So you just need to change the order in which you add the data.
 
Share this answer
 
PdfPTable pt = new PdfPTable(2); 2=1st column + 2nd column //Create a table and fix columns



=> then after add a cell by using table key "pt"
****Note : the creating of cells jumps over to its own position by based on fixing coloumns
pt.Addcell("cell1-row1") 1st column
pt.Addcell("cell2-row1") 2nd column
pt.Addcell("Cell3-row2") 1st column
pt.Addcell("Cell4-row2") 2nd column
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900