Novacode.Table.InsertRow C# (CSharp) Method

InsertRow() public method

Insert a row at the end of this table.
public InsertRow ( ) : Row
return Row
        public Row InsertRow()
        {
            return InsertRow(RowCount);
        }

Same methods

Table::InsertRow ( List content, Int32 index ) : Row
Table::InsertRow ( Row row ) : Row
Table::InsertRow ( Row row, int index ) : Row
Table::InsertRow ( int index ) : Row

Usage Example

Example #1
0
        private void AddRowWithReplacements(Table tbl, RollsheetPersonInfo m, int orgId)
        {
            var row = tbl.InsertRow(docx.Tables[0].Rows[0]);

            tbl.Rows.Add(row);
            var dict = replacements.DocXReplacementsDictionary(m.Person, orgId);

            foreach (var p in row.Paragraphs.Where(vv => vv.Text.HasValue()))
            {
                if (dict.Keys.Any(vv => p.Text.Contains(vv)))
                {
                    foreach (var d in dict)
                    {
                        if (p.Text.Contains(d.Key))
                        {
                            if (d.Key == "{barcodepeopleid}")
                            {
                                var s   = BarCodeStream(m.Person.PeopleId.ToString(), 40, showtext: false);
                                var img = curr.AddImage(s);
                                p.AppendPicture(img.CreatePicture());
                                p.ReplaceText(d.Key, "");
                            }
                            else if (d.Key.Equal("{MLG}"))
                            {
                                p.ReplaceText(d.Key, m.MemberTypeCode);
                            }
                            else if (d.Key.Equal("{highlight}"))
                            {
                                if (m.Highlight.HasValue())
                                {
                                    p.ReplaceText(d.Key, m.Highlight);
                                }
                                else
                                {
                                    p.Remove(false);
                                }
                            }
                            else if (d.Key.Equal("{altname}"))
                            {
                                p.ReplaceText(d.Key, m.UseAltName ? m.Person.AltName : "");
                            }
                            else if (d.Key.Equal("{name}"))
                            {
                                p.ReplaceText(d.Key, m.Person.Name2);
                                if (m.MemberTypeCode == "VS")
                                {
                                    row.Cells.Last().Shading = Color.FromArgb(226, 239, 217); // light green
                                }
                            }
                            else
                            {
                                p.ReplaceText(d.Key, d.Value);
                            }
                        }
                    }
                }
            }
        }
All Usage Examples Of Novacode.Table::InsertRow