Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Table Cell Source for Document Builder
public class TableCellSource : ISource
{
public WmlDocument WmlDocument { get; set; }
public bool KeepSections { get; set; }
public string InsertId { get; set; }
public int TableNum { get; set; }
public int RowNum { get; set; }
public int ColumnNum { get; set; }
public IEnumerable<XElement> GetElements(WordprocessingDocument document)
{
return document.MainDocumentPart.GetXDocument()
.Root
.Element(W.body)
.Elements(W.tbl)
.Skip(TableNum)
.Take(1)
.Elements(W.tr)
.Skip(RowNum)
.Take(1)
.Elements(W.tc)
.Skip(ColumnNum)
.Take(1)
.Elements()
.Skip(1)
.ToList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment