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 ?
Hello Thomas,
I am a little bit unsure what you are asking here. I see that you are adding three child nodes to your paragraph node, which appears to be placed in a table cell node (tcn). You say that you want to have your "1 2 3" content "in 3 cells hosted by one." I am under the impression that this means you would like to see three cells within a single cell of your table. Please correct me if I am incorrect, as my following explanation goes off of this impression.
Currently, you cannot place TableCellNodes within other TableCellNodes, but you can host tables within ParagraphNodes. Since you can do that, I would recommend using the below code to add a new table into your paragraph node at tcn.ChildNodes[index]:
ParagraphNode pn = tcn.ChildNodes[0] as ParagraphNode;pn.Document.InsertTable(0, 3, 1, out error);
The above obtains the first child node of a TableCellNode, and adds a 3 column, 1 row table into the paragraph node inside of the parent cell. I hope this helps you. Although, there is the possibility that my impression on this is flawed, and so if my above impression was incorrect, could you please provide some additional information on the functionality that you are looking to achieve?
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
I try your solution, but the result is a cellinception because cells are hosted by cells hosted by cells....
I share a little result of the array that I want to display : http://gyazo.com/15f2a5ee86b46c230dce04529d0c17ab
At the left, 1 cell at the column "Stock" host 3 lines of objects.
I'll be able to do a foreach to set values, I just need code about child cells with assignement expressions.
Thnaks for your help.
Hello teamtim,
Thank you for the gyazo link to your image. I see now that the functionality that you are looking to achieve is more of a "merged cell" type of functionality, rather than cells inside of cells.
You can obtain this functionality by setting the VerticalMerge property on your TableCellNode's TableCellSettings object, which you can assign to the TableCellNode.Settings property on your cell. You will want to start the merge at the cell below the starting one, and continue down through each row that you wish to merge.
I have attached a sample project to demonstrate the above, by creating the table shown in the image at the link you provided.
Please let me know if you have any other questions or concerns on this matter.
The project is good.
I have an issue with thecopy/paste process, I post a topic about that.
Regards
Just checking in, did you have any other questions or concerns on this matter?