API Reference
WordSmartArt
Represents a SmartArt diagram in a WordDocument.
Inheritance
- WordElement
- WordSmartArt
Methods
public Void AddNode(String text) #VoidAdds a new node (algorithmic layouts only: BasicProcess or Cycle) and sets its text.
Parameters
- text System.String
public Void ClearNodes() #VoidRemoves all nodes (algorithmic layouts only). Diagram remains with no child nodes.
public String GetNodeText(Int32 index) #StringReturns the text of the node at the specified 0-based index.
Parameters
- index System.Int32
- The 0-based position of the SmartArt node whose text should be retrieved.
Returns
The concatenated text content of the targeted node, or an empty string when the node has no text.
public Void InsertNodeAt(Int32 index, String text) #VoidInserts a node at a specific index (algorithmic layouts only). Re-sequences following nodes.
Parameters
- index System.Int32
- text System.String
public Void RemoveNodeAt(Int32 index) #VoidRemoves a node by index (algorithmic layouts only).
Parameters
- index System.Int32
public Void ReplaceTexts(IEnumerable<String> texts) #VoidReplaces node texts sequentially starting at index 0. If more texts are provided than nodes, extras are ignored. If fewer texts are provided, remaining nodes are left unchanged.
Parameters
- texts System.Collections.Generic.IEnumerable{System.String}
- The ordered replacement strings to apply to each node in turn.
public Void ReplaceTexts(params String[] texts) #VoidConvenience overload for replacing node texts sequentially using a parameter array.
Parameters
- texts System.String[]
- The ordered replacement strings to apply to each node in turn.
public Void ReplaceTexts(Boolean bold, Boolean italic, Boolean underline, String colorHex = null, Nullable<Double> sizePt = null, params String[] texts) #VoidReplaces node texts sequentially while applying the same formatting to every replacement value. If more texts are provided than nodes, extras are ignored. If fewer are provided, remaining nodes are unchanged.
Parameters
- texts System.Collections.Generic.IEnumerable{System.String}
- The ordered replacement strings to apply to each node in turn.
- bold System.Boolean
- True to render each replacement in bold; otherwise false.
- italic System.Boolean
- True to render each replacement in italics; otherwise false.
- underline System.Boolean = null
- True to underline each replacement; otherwise false.
- colorHex System.String = null
- An optional RGB color value (for example, "FF0000") applied to each replacement, or null to keep the existing color.
- sizePt System.Nullable{System.Double} = null
- An optional font size in points applied to each replacement, or null to keep the existing size.
ReplaceTexts(System.Boolean bold, System.Boolean italic, System.Boolean underline, System.String colorHex, System.Nullable{System.Double} sizePt, System.String[] texts) #Convenience overload that applies the specified formatting to each provided replacement string.
Parameters
- bold System.Boolean
- True to render each replacement in bold; otherwise false.
- italic System.Boolean
- True to render each replacement in italics; otherwise false.
- underline System.Boolean
- True to underline each replacement; otherwise false.
- colorHex System.String
- An optional RGB color value (for example, "FF0000") applied to each replacement, or null to keep the existing color.
- sizePt System.Nullable{System.Double}
- An optional font size in points applied to each replacement, or null to keep the existing size.
- texts System.String[]
- The ordered replacement strings to apply to each node in turn.
public Void SetNodeText(Int32 index, String text) #VoidSets the text of the node at the specified 0-based index while preserving the paragraph end run properties.
Parameters
- index System.Int32
- The 0-based position of the SmartArt node whose content should be replaced.
- text System.String
- The replacement text to apply to the node.
public Void SetNodeText(Int32 index, String text, Boolean bold, Boolean italic) #VoidSets the text of the node at the specified 0-based index while applying basic formatting options.
Parameters
- index System.Int32
- The 0-based position of the SmartArt node whose content should be replaced.
- text System.String
- The replacement text to apply to the node.
- bold System.Boolean
- True to render the new text in bold; otherwise false.
- italic System.Boolean
- True to render the new text in italics; otherwise false.
public Void SetNodeText(Int32 index, String text, Boolean bold, Boolean italic, Boolean underline, String colorHex, Nullable<Double> sizePt) #VoidSets the text of the node at the specified 0-based index while applying extended formatting options.
Parameters
- index System.Int32
- The 0-based position of the SmartArt node whose content should be replaced.
- text System.String
- The replacement text to apply to the node.
- bold System.Boolean
- True to render the new text in bold; otherwise false.
- italic System.Boolean
- True to render the new text in italics; otherwise false.
- underline System.Boolean
- True to underline the new text; otherwise false.
- colorHex System.String
- An optional RGB color value (for example, "FF0000") applied to the new text, or null to keep the existing color.
- sizePt System.Nullable{System.Double}
- An optional font size in points applied to the new text, or null to keep the existing size.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public Int32 NodeCount { get; } #Gets the number of editable node paragraphs in the SmartArt. Nodes are detected as points that have a text body and no explicit type (not doc/parTrans/sibTrans/pres).
public Boolean CanModifyNodes { get; } #Indicates whether this SmartArt type supports adding/removing/reordering nodes.