Skip to content

Commit 355d7b1

Browse files
Merge pull request #355 from SyncfusionExamples/Working-with-SmartArts
ES-933301 - Modified the sample in Working-with-SmartArts
2 parents d7c1e47 + 15d7f97 commit 355d7b1

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed
Binary file not shown.

SmartArts/Set-assistant-to-normal-node/.NET/Set-assistant-to-normal-node/Program.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@
55
using System.IO;
66

77
//Create a new Word document instance.
8-
WordDocument document = new WordDocument();
9-
//Add a new section to the document.
10-
IWSection section = document.AddSection();
11-
//Add a paragraph to the section.
12-
IWParagraph paragraph = section.AddParagraph();
8+
WordDocument wordDocument = new WordDocument();
9+
//Add one section and one paragraph to the document.
10+
wordDocument.EnsureMinimal();
1311
//Add a SmartArt to the paragraph at the specified size.
14-
WSmartArt smartArt = paragraph.AppendSmartArt(OfficeSmartArtType.OrganizationChart, 432, 252);
12+
WSmartArt smartArt = wordDocument.LastParagraph.AppendSmartArt(OfficeSmartArtType.OrganizationChart, 640, 426);
1513
//Traverse through all nodes of the SmartArt.
1614
foreach (IOfficeSmartArtNode node in smartArt.Nodes)
1715
{
18-
//Check if the node is assistant or not.
19-
if (node.IsAssistant)
20-
//Set the assistant node to false.
21-
node.IsAssistant = false;
16+
foreach (IOfficeSmartArtNode childNode in node.ChildNodes)
17+
{
18+
//Check if the node is assistant or not.
19+
if (childNode.IsAssistant)
20+
//Set the assistant node to false.
21+
childNode.IsAssistant = false;
22+
}
2223
}
2324
// Create a file stream to save the modified document.
2425
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))

0 commit comments

Comments
 (0)