WordSmartArt
OfficeIMO.Word
Represents a SmartArt diagram in a WordDocument.
Inheritance
- WordElement
- WordSmartArt
Usage
Explore 10 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 10
- Method WordDocument.AddSmartArt
- Property WordDocument.SmartArts
- Property WordFooter.SmartArts
- Property WordHeader.SmartArts
- Property WordHeaderFooter.SmartArts
- Method WordParagraph.AddSmartArt
- Property WordParagraph.SmartArt
- Method WordSection.AddSmartArt
- Property WordSection.SmartArts
- Property WordSmartArtNode.SmartArt
Methods
public WordSmartArtNode AddNode(string text) #Adds a new node (algorithmic layouts only: BasicProcess or Cycle) and sets its text.
Parameters
- text string
public void ClearNodes() #Removes all nodes (algorithmic layouts only). Diagram remains with no child nodes.
public string GetNodeText(int index) #Returns the text of the node at the specified 0-based index.
Parameters
- index int
- The 0-based position of the SmartArt node whose text should be retrieved.
Returns
string The concatenated text content of the targeted node, or an empty string when the node has no text.public void InsertNodeAt(int index, string text) #Inserts a node at a specific index (algorithmic layouts only). Re-sequences following nodes.
Parameters
- index int
- text string
public void MoveNode(int fromIndex, int toIndex) #Reorders one node inside a supported algorithmic layout by changing its document-child order. This is a structural SmartArt ordering edit, not a rendered-coordinate move.
Parameters
- fromIndex int
- toIndex int
public void RemoveNodeAt(int index) #Removes a node by index (algorithmic layouts only).
Parameters
- index int
public void ReplaceTexts(IEnumerable<string> texts) #Replaces 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<string>
- The ordered replacement strings to apply to each node in turn.
public void ReplaceTexts(params string[] texts) #Convenience overload for replacing node texts sequentially using a parameter array.
Parameters
- texts string[]
- The ordered replacement strings to apply to each node in turn.
public void ReplaceTexts(IEnumerable<string> texts, bool bold, bool italic, bool underline, OfficeColor? color = null, OfficeLength? fontSize = null) #Replaces 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<string>
- The ordered replacement strings to apply to each node in turn.
- bold bool
- True to render each replacement in bold; otherwise false.
- italic bool
- True to render each replacement in italics; otherwise false.
- underline bool
- True to underline each replacement; otherwise false.
- color OfficeIMO.OfficeColor? = null
- An optional RGB color applied to each replacement, or null to keep the existing color.
- fontSize OfficeIMO.OfficeLength? = null
- An optional physical font size applied to each replacement, or null to inherit the diagram font size.
public void ReplaceTexts(bool bold, bool italic, bool underline, OfficeColor? color = null, OfficeLength? fontSize = null, params string[] texts) #Convenience overload that applies the specified formatting to each provided replacement string.
Parameters
- bold bool
- True to render each replacement in bold; otherwise false.
- italic bool
- True to render each replacement in italics; otherwise false.
- underline bool
- True to underline each replacement; otherwise false.
- color OfficeIMO.OfficeColor? = null
- An optional RGB color applied to each replacement, or null to keep the existing color.
- fontSize OfficeIMO.OfficeLength? = null
- An optional physical font size applied to each replacement, or null to inherit the diagram font size.
- texts string[]
- The ordered replacement strings to apply to each node in turn.
public void SetNodeText(int index, string text) #Sets the text of the node at the specified 0-based index while preserving the paragraph end run properties.
Parameters
- index int
- The 0-based position of the SmartArt node whose content should be replaced.
- text string
- The replacement text to apply to the node.
public void SetNodeText(int index, string text, bool bold, bool italic) #Sets the text of the node at the specified 0-based index while applying basic formatting options.
Parameters
- index int
- The 0-based position of the SmartArt node whose content should be replaced.
- text string
- The replacement text to apply to the node.
- bold bool
- True to render the new text in bold; otherwise false.
- italic bool
- True to render the new text in italics; otherwise false.
public void SetNodeText(int index, string text, bool bold, bool italic, bool underline, OfficeColor? color, OfficeLength? fontSize) #Sets the text of the node at the specified 0-based index while applying extended formatting options.
Parameters
- index int
- The 0-based position of the SmartArt node whose content should be replaced.
- text string
- The replacement text to apply to the node.
- bold bool
- True to render the new text in bold; otherwise false.
- italic bool
- True to render the new text in italics; otherwise false.
- underline bool
- True to underline the new text; otherwise false.
- color OfficeIMO.OfficeColor?
- An optional RGB color applied to the new text, or null to keep the existing color.
- fontSize OfficeIMO.OfficeLength?
- An optional physical font size applied to the new text, or null to inherit the diagram font size.
public bool TryGetLayoutSnapshot(out WordDrawingLayoutInfo snapshot) #Reads persisted inline or anchored package geometry for this SmartArt diagram.
Parameters
- snapshot OfficeIMO.Word.WordDrawingLayoutInfo
- The package-geometry snapshot when the diagram has a supported frame.
Returns
bool true when persisted layout evidence was available.Inherited Methods
Properties
public int 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 bool CanModifyNodes { get; } #Indicates whether this SmartArt type supports adding/removing/reordering nodes.
public IReadOnlyList<WordSmartArtNode> Nodes { get; } #Gets attached editable nodes in their current diagram order.