An abstract ContentPart defines a part activity definition. DocumentParts performs a foreach loop over a ContentPart to render Open XML parts.
ContentPart activity definition
  public abstract class ContentPart : Activity
    //Document or Worksheet
    public InArgument<string> ViewName { get; set; }

    //Refers to ContentControl.Tag, Cell.Name, or Cell.Reference
    public InArgument<string> Reference { get; set; }

    public OutArgument<string> Value { get; set; }

 DocumentPart loop over ContentPart activities

//Add ContentParts dropped onto DocumentParts
foreach (Activity a in this.Activities)
  ContentPart part = (ContentPart)a;

  reference = part.Reference.Expression.ToString();
  viewName = part.ViewName.Expression.ToString();

  // Find the sheet with the supplied name, and then use that Sheet object to retrieve a reference to the   
  appropriate worksheet.
  Sheet sheet = document.WorkbookPart.Workbook.Descendants<Sheet>().Where(s => s.Name ==   
  contentParts.Add(part.Reference.Expression.ToString(), GetCellValue(sheet.Id, reference));
RangePart Activity

The follow image shows RangeParts dropped into a DocumentParts activity. The current version supports a simple ContentPart activity containing the following arguments:

  • InArgument <string> ViewName – Name of a document view such as “Sheet1” for a worksheet. A view name could be a parent Word content control.
  • InArgument<string> Reference – Name of the target content part reference such as “A1” for a cell. A reference name could be a child Word content control.
  • OutArgument<string> Value – Scalar content part value such as the value of cell “A1”.


Last edited Oct 10, 2011 at 3:51 AM by dvana, version 7


No comments yet.