Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1700
Add multiple cells in TableCellNode
posted

Hello,

I want to add cells into one cell.

My code is :

tcn = trn.ChildNodes[3] as TableCellNode;
if (rowCounter % 2 != 0) tcn.Settings = rowAlternatingSettings;
else tcn.Settings = rowSettings;
pn = tcn.ChildNodes[0] as ParagraphNode;
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "1"));
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "2"));
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "3"));

To have 1,2,3 in 3 cells hosted by one.

I try this but I'm out of index :

tcn = trn.ChildNodes[3] as TableCellNode;
if (rowCounter % 2 != 0) tcn.Settings = rowAlternatingSettings;
else tcn.Settings = rowSettings;
pn = tcn.ChildNodes[0] as ParagraphNode;
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "1"));

pn = tcn.ChildNodes[1] as ParagraphNode;
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "2"));

pn = tcn.ChildNodes[2] as ParagraphNode;
pn.ChildNodes.Add(CreateRunNodeWithContent(charSettings, "3"));

3 cells is an example, I can have 10 or 20 cells to host.

Could you help me ?