Skip to content

Instantly share code, notes, and snippets.

@sergey-tihon
Created September 28, 2012 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergey-tihon/3799948 to your computer and use it in GitHub Desktop.
Save sergey-tihon/3799948 to your computer and use it in GitHub Desktop.
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