Hi,
Im trying to populate my table with information from an array.
I used "How to Draw PDF Table in C#" post to help me populate my own table, i did the exact same things as this post, but i am getting exceptions
saying "End column index is less than start column index." I wonder what i did wrong.
Here are parts of my quote
String[] data = new String[ls2.Count];
data = ls2.ToArray();
String[][] datasource = new String[data.Length][];
for (int i = 0; i < data.Length; i++)
{
datasource[i] = data[i].Split(';');
}
// Console.WriteLine(ls[linenumber][0]);
PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("Arial", 16f, FontStyle.Bold));
PdfStringFormat format1 = new PdfStringFormat(PdfTextAlignment.Center);
float y = 10;
y = y + font1.MeasureString("Country List", format1).Height;
y = y + 5;
PdfTable table = new PdfTable();
table.Style.CellPadding = 2;
table.Style.HeaderStyle.StringFormat = new PdfStringFormat(PdfTextAlignment.Center);
table.Style.HeaderSource = PdfHeaderSource.Rows;
table.Style.HeaderRowCount = 1;
table.Style.ShowHeader = true;
table.Style.HeaderStyle.BackgroundBrush = PdfBrushes.CadetBlue;
//table.DataSource = datasource;
foreach (PdfColumn col in table.Columns)
col.StringFormat = new PdfStringFormat(PdfTextAlignment.Center, PdfVerticalAlignment.Middle);
Console.WriteLine($"{string.Join('!', data)}");
// table.Draw(page, new PointF(0, 12));
table.Draw(page, new PointF(0f, y));
// Console.WriteLine("done");
// Console.WriteLine($"{string.Join('!', data)}");
doc2.SaveToFile(pdfOutputPath);
my data array contains (0.00;0.00;-798.71;-798.71;0.00;-798.71;-798.71;0.00;Yes;798.71;798.71;0.00) this information.