Hi,
I am trying to create a table from a list in asp.net core application but I have challenges implementing it
The variable "bene" is holding a list which I want to append to the table and replace with placeholder "
XfactorX"
I having challenges implementing that
WTable BeneTable = new WTable(document);
BeneTable.ResetCells(1, bene.Count + 1);
BeneTable[0, 0].Width = 52f;
BeneTable[0, 0].AddParagraph().AppendText("FirstName");
BeneTable[0, 1].Width = 128f;
BeneTable[0, 1].AddParagraph().AppendText("LastName");
for (int i = 1; i < bene.Count; i++)
{
BeneTable[0, i].AddParagraph().AppendText(bene[i].FirstName);
BeneTable[0, i+1].AddParagraph().AppendText(bene[i].FirstName);
}
BeneTable.ApplyStyle(BuiltinTableStyle.MediumShading1Accent1);
//Replaces the table placeholder text with a new table
TextBodyPart bodyPart = new TextBodyPart(document);
bodyPart.BodyItems.Add(BeneTable);
document.Replace("XfactorX", bodyPart, true, true, true);
Thanks