Skip to content

Commit 9b2469e

Browse files
committed
Added new examples.
1 parent 6d778c6 commit 9b2469e

File tree

78 files changed

+1410
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1410
-65
lines changed
39.5 KB
Binary file not shown.

src/programmersguide/smartartinpresentation/accesssmartartnodes/accesschildnodes/java/AccessChildNodes.java

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,40 @@ public static void main(String[] args) throws Exception
1616
{
1717
// The path to the documents directory.
1818
String dataDir = "src/programmersguide/smartartinpresentation/accesssmartartnodes/accesschildnodes/data/";
19-
20-
19+
20+
//Instantiate Presentation Class
21+
Presentation pres = new Presentation(dataDir+"SimpleSmartArt.pptx");
22+
23+
//Get first slide
24+
ISlide slide = pres.getSlides().get_Item(0);
25+
26+
//Traverse through every shape inside first slide
27+
for(IShape shape : slide.getShapes())
28+
{
29+
//Check if shape is of SmartArt type
30+
if (shape instanceof ISmartArt)
31+
{
32+
//Typecast shape to SmartArtEx
33+
ISmartArt smart = (ISmartArt)shape;
34+
35+
//Traverse through all nodes inside SmartArt
36+
for (int i = 0; i < smart.getAllNodes().getCount(); i++)
37+
{
38+
//Accessing SmartArt node at index i
39+
SmartArtNode node0 = (SmartArtNode)smart.getAllNodes().get_Item(i);
40+
41+
//Traversing through the child nodes in SmartArt node at index i
42+
for (int j = 0; j < node0.getChildNodes().getCount(); j++)
43+
{
44+
//Accessing the child node in SmartArt node
45+
SmartArtNode node = (SmartArtNode)node0.getChildNodes().get_Item(j);
46+
47+
//Printing the SmartArt child node parameters
48+
System.out.print("j = "+j+", Text = "+node.getTextFrame().getText()+", Level = "+node.getLevel()+", Position = "+node.getPosition());
49+
}
50+
}
51+
}
52+
}
2153
}
2254
}
2355

39.5 KB
Binary file not shown.

src/programmersguide/smartartinpresentation/accesssmartartnodes/accesssmartart/java/AccessSmartArt.java

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,34 @@ public static void main(String[] args) throws Exception
1616
{
1717
// The path to the documents directory.
1818
String dataDir = "src/programmersguide/smartartinpresentation/accesssmartartnodes/accesssmartart/data/";
19-
20-
19+
20+
//Instantiate Presentation Class
21+
Presentation pres = new Presentation(dataDir+ "SimpleSmartArt.pptx");
22+
23+
//Get first slide
24+
ISlide slide = pres.getSlides().get_Item(0);
25+
26+
//Traverse through every shape inside first slide
27+
for(IShape shape : slide.getShapes())
28+
{
29+
//Check if shape is of SmartArt type
30+
if (shape instanceof ISmartArt)
31+
{
32+
//Typecast shape to SmartArtEx
33+
ISmartArt smart = (ISmartArt)shape;
34+
35+
//Traverse through all nodes inside SmartArt
36+
for (int i = 0; i < smart.getAllNodes().getCount(); i++)
37+
{
38+
//Accessing SmartArt node at index i
39+
SmartArtNode node = (SmartArtNode)smart.getAllNodes().get_Item(i);
40+
41+
//Printing the SmartArt node parameters
42+
System.out.print(node.getTextFrame().getText()+" " + node.getLevel()+" " + node.getPosition());
43+
44+
}
45+
}
46+
}
2147
}
2248
}
2349

src/programmersguide/smartartinpresentation/accesssmartartnodes/childnodespecificposition/java/ChildNodeSpecificPosition.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,25 @@ public static void main(String[] args) throws Exception
1616
{
1717
// The path to the documents directory.
1818
String dataDir = "src/programmersguide/smartartinpresentation/accesssmartartnodes/childnodespecificposition/data/";
19-
20-
19+
20+
//Instantiate the presentation
21+
Presentation pres = new Presentation();
22+
23+
//Accessing the first slide
24+
ISlide slide = pres.getSlides().get_Item(0);
25+
26+
//Adding the SmartArt shape in first slide
27+
ISmartArt smart = slide.getShapes().addSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);
28+
29+
//Accessing the SmartArt node at index 0
30+
ISmartArtNode node = smart.getAllNodes().get_Item(0);
31+
32+
//Accessing the child node at position 1 in parent node
33+
int position = 1;
34+
SmartArtNode chNode = (SmartArtNode)((SmartArtNodeCollection)node.getChildNodes()).getNodeByPosition(position);
35+
36+
//Printing the SmartArt child node parameters
37+
System.out.print("Text = "+chNode.getTextFrame().getText()+", Level = "+chNode.getLevel()+", Position = "+chNode.getPosition());
2138
}
2239
}
2340

38.5 KB
Binary file not shown.

src/programmersguide/smartartinpresentation/addaccesssmartart/accessingsmartartshape/java/AccessingSmartArtShape.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,22 @@ public static void main(String[] args) throws Exception
1616
{
1717
// The path to the documents directory.
1818
String dataDir = "src/programmersguide/smartartinpresentation/addaccesssmartart/accessingsmartartshape/data/";
19-
19+
//Instantiate Presentation Class
20+
Presentation pres = new Presentation(dataDir+ "SimpleSmartArt.pptx");
21+
22+
//Get first slide
23+
ISlide slide = pres.getSlides().get_Item(0);
24+
25+
//Traverse through every shape inside first slide
26+
for(IShape shape : pres.getSlides().get_Item(0).getShapes())
27+
{
28+
//Check if shape is of SmartArt type
29+
if (shape instanceof ISmartArt)
30+
{
31+
//Typecast shape to SmartArtEx
32+
ISmartArt smart = (ISmartArt)shape;
33+
}
34+
}
2035

2136
}
2237
}
38.5 KB
Binary file not shown.

src/programmersguide/smartartinpresentation/addaccesssmartart/creatingsmartartshape/java/CreatingSmartArtShape.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,18 @@ public static void main(String[] args) throws Exception
1616
{
1717
// The path to the documents directory.
1818
String dataDir = "src/programmersguide/smartartinpresentation/addaccesssmartart/creatingsmartartshape/data/";
19-
20-
19+
20+
//Instantiate Presentation Class
21+
Presentation pres = new Presentation();
22+
23+
//Get first slide
24+
ISlide slide = pres.getSlides().get_Item(0);
25+
26+
//Add Smart Art Shape
27+
ISmartArt smart = slide.getShapes().addSmartArt(0, 0, 400, 400, SmartArtLayoutType.BasicBlockList);
28+
29+
//Saving presentation
30+
pres.save(dataDir+ "SimpleSmartArt.pptx", SaveFormat.Pptx);
2131
}
2232
}
2333

39.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)