How can I create a horizontal table in a pdf. This means:
column1 : data
column2 : data2
column3 : data3 ... and so on
and not:
column1 column2 column3
data data2 data3
thank you
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add();
String[] data = {
"column1;data1",
"column2;data2",
"column3;data3",
};
String[][] dataSource = new String[data.Length][];
for (int i = 0; i < data.Length; i++)
{
dataSource[i] = data[i].Split(';');
}
PdfTable table = new PdfTable();
table.DataSource = dataSource;
table.BeginRowLayout += Table_BeginRowLayout;
table.Draw(page, new RectangleF(0, 20, 200, 90));
doc.SaveToFile("result.pdf");
doc.Close();
}
private static void Table_BeginRowLayout(object sender, BeginRowLayoutEventArgs args)
{
args.MinimalHeight = 20f;
}