Hello all,
I’m struggling for couple of days on creating table and it’s width settings. I have already generated table like this
and it’s completely fine for me. The problem is that the cell width is setted automatically, so when some of the content in table is wider, this will happen:
My goal is to set explicitly first two rows width and another row can has dynamic width. But how to do this? Of course i have read tons of articles about seeting preffered width and so on, but it doesn’t work for me! Here’s an code example how I try to set first two rows by preffered width by percent:
Table table = builder.StartTable();
builder.CellFormat.ClearFormatting();
builder.Font.Size = 11;
builder.Font.Bold = true;
builder.InsertCell();
builder.Write("Kolo");
builder.InsertCell();
builder.Write("Připomínka");
builder.InsertCell();
builder.Write("Autor");
builder.InsertCell();
builder.Write("Role");
builder.InsertCell();
builder.Write("Datum");
builder.InsertCell();
builder.CellFormat.WrapText = true;
builder.Write("Co komentuji");
builder.InsertCell();
builder.Write("Compliance riziko");
builder.EndRow();
builder.Font.Bold = false;
builder.Font.Size = 9;
builder.InsertCell();
builder.Write(row["Kolo"] != DBNull.Value ? (string)row["Kolo"] : "");
builder.InsertCell();
builder.Write(row["Připomínka"] != DBNull.Value ? $"{(int)row["Připomínka"]}" : "");
builder.InsertCell();
builder.Write(row["Autor připomínky"] != DBNull.Value ? (string)row["Autor připomínky"] : "");
builder.InsertCell();
builder.Write(row["Role"] != DBNull.Value ? (string)row["Role"] : "");
builder.InsertCell();
builder.Write(row["Datum zapsání"] != DBNull.Value ? $"{(DateTime)row["Datum zapsání"]}" : "");
builder.InsertCell();
builder.Write(row["Co komentuji"] != DBNull.Value ? (string)row["Co komentuji"] : "");
builder.InsertCell();
builder.Write(row["Complience riziko"] != DBNull.Value ? (string)row["Complience riziko"] : "");
builder.CellFormat.FitText = false;
builder.CellFormat.PreferredWidth = PreferredWidth.FromPercent(15);
builder.EndRow();
what am I missing?