Interface ISmartArtNodes
Represents a collection of nodes within a SmartArt diagram.
Namespace: Syncfusion.Presentation
Assembly: Syncfusion.Presentation.Portable.dll
Syntax
public interface ISmartArtNodes : IEnumerable<ISmartArtNode>, IEnumerable
Properties
Count
Gets the number of nodes contained in the SmartArt node collection. Read-only.
Declaration
int Count { get; }
Property Value
Type |
---|
System.Int32 |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a BasicBlockList SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426);
//Gets the number of nodes
int count = smartArt.Nodes.Count;
//Save the Presentation
pptxDoc.Save("Sample.pptx");
//Close the Presentation
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a BasicBlockList SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426)
'Gets the number of nodes.
Dim count As Integer = smartArt.Nodes.Count
'Save the Presentation
pptxDoc.Save("Sample.pptx")
'Close the Presentation
pptxDoc.Close()
Item[Int32]
Gets a node at the specified index of a SmartArt node collection. Read-only.
Declaration
ISmartArtNode this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Determines the index of the SmartArt node. |
Property Value
Type | Description |
---|---|
ISmartArtNode | Returns an ISmartArtNode instance. |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a BasicBlockList SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426);
//Gets the first smart art node
ISmartArtNode node = smartArt.Nodes[0];
//Sets the text to the node.
node.TextBody.AddParagraph("First node text");
//Save the Presentation
pptxDoc.Save("Sample.pptx");
//Close the Presentation
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a BasicBlockList SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 0, 0, 640, 426)
'Gets the first smart art node
Dim node As ISmartArtNode = smartArt.Nodes(0)
'Sets the text to the node.
node.TextBody.AddParagraph("First node text")
'Save the Presentation
pptxDoc.Save("Sample.pptx")
'Close the Presentation
pptxDoc.Close()
Methods
Add()
Adds a new SmartArt node at the end of the SmartArt node collection.
Declaration
ISmartArtNode Add()
Returns
Type | Description |
---|---|
ISmartArtNode | Returns an ISmartArtNode instance that represents the new SmartArt diagram. |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426);
// Add a new node to the SmartArt.
ISmartArtNode newNode = smartArt.Nodes.Add();
// Set a text to newly added child node.
newNode.TextBody.AddParagraph("Added new node to the smart art shape.");
//Save the Presentation.
pptxDoc.Save("Sample.pptx");
//Close the Presentation.
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 10, 10, 640, 426)
'Add a new node to the SmartArt.
Dim newNode As ISmartArtNode = smartArt.Nodes.Add()
'Set a text to newly added child node.
newNode.TextBody.AddParagraph("Parent node for the child node.")
'Save the Presentation.
pptxDoc.Save("Sample.pptx")
'Close the Presentation.
pptxDoc.Close()
Clear()
Removes all the nodes from the SmartArt.
Declaration
void Clear()
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a BasicBlockList SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426);
//Sets the background color for the smart art shape
smartArt.Background.SolidFill.Color = ColorObject.AliceBlue;
//Clear the smart art nodes.
smartArt.Nodes.Clear();
//Save the Presentation
pptxDoc.Save("Sample.pptx");
//Close the Presentation
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a BasicBlockList SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426)
'Sets the background color for the smart art shape
smartArt.Background.SolidFill.Color = ColorObject.AliceBlue
'Clear the smart art nodes.
smartArt.Nodes.Clear()
'Save the Presentation
pptxDoc.Save("Sample.pptx")
'Close the Presentation
pptxDoc.Close()
IndexOf(ISmartArtNode)
Returns the first occurrence of a specified node from the SmartArt node collection.
Declaration
int IndexOf(ISmartArtNode smartArtNode)
Parameters
Type | Name | Description |
---|---|---|
ISmartArtNode | smartArtNode | The ISmartArtNode instance to locate in the collection. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the zero-based index of the first occurrence of SmartArt node within the collection, if found; otherwise, �1. |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 0, 0, 640, 426);
// Add a new node to the SmartArt.
ISmartArtNode newNode = smartArt.Nodes.Add();
// Set a text to newly added child node.
newNode.TextBody.AddParagraph("Added new node to the smart art shape.");
//Gets the index of new node.
int index = smartArt.Nodes.IndexOf(newNode);
//Save the Presentation.
pptxDoc.Save("Sample.pptx");
//Close the Presentation.
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.AlternatingHexagons, 10, 10, 640, 426)
'Add a new node to the SmartArt.
Dim newNode As ISmartArtNode = smartArt.Nodes.Add()
'Set a text to newly added child node.
newNode.TextBody.AddParagraph("Added new node to the smart art shape.")
'Gets the index of new node.
Dim index As Integer = smartArt.Nodes.IndexOf(newNode)
'Save the Presentation.
pptxDoc.Save("Sample.pptx")
'Close the Presentation.
pptxDoc.Close()
Remove(ISmartArtNode)
Removes the first occurrence of a specified node from the SmartArt node collection.
Declaration
bool Remove(ISmartArtNode smartArtNode)
Parameters
Type | Name | Description |
---|---|---|
ISmartArtNode | smartArtNode | The SmartArt node to be removed from the collection. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the specified SmartArt node is removed from the node collection otherwise returns false. |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a BasicBlockList SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426);
//Gets the first smart art node.
ISmartArtNode node = smartArt.Nodes[0];
//Remove the smart art node from the node collection.
smartArt.Nodes.Remove(node);
//Save the Presentation
pptxDoc.Save("Sample.pptx");
//Close the Presentation
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a BasicBlockList SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426)
'Gets the first smart art node
Dim node As ISmartArtNode = smartArt.Nodes(0)
'Remove the smart art node from the node collection.
smartArt.Nodes.Remove(node)
'Save the Presentation
pptxDoc.Save("Sample.pptx")
'Close the Presentation
pptxDoc.Close()
RemoveAt(Int32)
Removes the node at the specified index of SmartArt node collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to be removed. |
Examples
// Create an instance of PowerPoint Presentation
IPresentation pptxDoc = Presentation.Create();
//Add a blank slide to the Presentation
ISlide slide = pptxDoc.Slides.Add(SlideLayoutType.Blank);
//Add a BasicBlockList SmartArt to the slide at the specified size and position.
ISmartArt smartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426);
//Gets the first smart art node.
ISmartArtNode node = smartArt.Nodes[0];
//Remove the smart art node from the node collection.
smartArt.Nodes.RemoveAt(1);
//Save the Presentation
pptxDoc.Save("Sample.pptx");
//Close the Presentation
pptxDoc.Close();
'Create an instance of PowerPoint Presentation
Dim pptxDoc As IPresentation = Presentation.Create()
'Add a blank slide to the Presentation
Dim slide As ISlide = pptxDoc.Slides.Add(SlideLayoutType.Blank)
'Add a BasicBlockList SmartArt to the slide at the specified size and position.
Dim smartArt As ISmartArt = slide.Shapes.AddSmartArt(SmartArtType.BasicBlockList, 100, 50, 640, 426)
'Gets the first smart art node
Dim node As ISmartArtNode = smartArt.Nodes(0)
'Remove the smart art node from the node collection.
smartArt.Nodes.RemoveAt(1)
'Save the Presentation
pptxDoc.Save("Sample.pptx")
'Close the Presentation
pptxDoc.Close()