[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3299
  • Last Modified:

Is there any way to access "Smartart object model" in MS-Office 2007 (Word, PPT, Excel) using VBA macro/C#/C++ ?

Hello Expert,

I want to extract information/properties of Smartart Graphics at runtime while an MS-Office document is opened.
So I need to access smartart object model of MS-Office 2007(Word, PPT, Excel) using VBA Macro/C#/Cplusplus.

Is there any way to access this Object model?

Thanks,
Ajit.
0
ashugarg00
Asked:
ashugarg00
1 Solution
 
ashugarg00Author Commented:
Actually there is no SmartArt model supported in MS Office 2007. But several properties we can extract like:

Selection in SmartArt
Each time when selection changes in document (Word, Power point, Excel), WindowSelectionChange -event is Fired by the Application. Selection of element can be get from COM and different for Each Application.
For Powerpoint,
1.      Total Number of Elements selected in Powerpoint = (ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> Count).
2.      Array of selected shape = (ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> items).
3.      If ActiveWindow -> ActiveWindow ->Selection -> ShapeRange -> item(i) == msoSmartArt, the element is SmartArt.
4.      To Uniquely identify the SmartArt (Shape), Id/Name attribute is used.
5.      Up to now we are able to get the selection of the parent element of SmartArt. To Get the selection about the child element.
a.      If ActiveWindow -> ActiveWindow ->Selection-> hasChildShapeRange == true, then some child is selected in the Smartart, else not.
b.      Array of the SmartArt child elements  = (ActiveWindow -> ActiveWindow ->Selection -> ChildShapeRange->items).
c.      Count of Array of SmartArt elements = (ActiveWindow -> ActiveWindow ->Selection -> ChildShapeRange->Count).
d.      Z-order is unique for each shape, We can use it to identify the child shape.
For Word,
Two types of Smartart element are available in Word: Inline & Floating.
Inline SmartArt (WdInlineShapeSmartArt):
1.      Array of Inline Shape = (Application -> ActiveDocument -> InlineShapes -> items). For count of inline shapes use Count Property.
2.      If item-> type == WdInlineShapeSmartArt, Smartart inline found.
To indentify uniquely this inline shape, use Range property (Value of Start & End property). Id property is not associated with these shapes.
3.      For Child Selection read the Powerpoint Module.
Floating Smartart (msoSmartArt):
1.      Array of Shapes = (Application -> ActiveDocument -> Shpaes -> items).
2.      If item->type == msoSmartArt, Floating SmartArt fount. Id property is used to uniquely identify the element.
3.      For Child, same as in the Power point.
For Excel,
I think there is one or more solution possible to get the selection in SmartArt. Below is shown one solution:
1.      Selection object = (Application -> Selection)
2.      Get the type of selected element, If Type == msoAutoShape, selected element is Shape && If Child == true, selected element is Child element. If it is having ParentGroup property, check the Type property. If Type == msoSmartArt, we are sure about the Smartart element selection.
3.      Child element in Smartart is uniquely identified by its Z-order.
4.      If Single element is selected then ParentGroup is outside the element
5.      Selection element count = (Application -> Selection -> Count).
6.      If Count >= 1, check ParentGroup of each element, it will give details of the Smartart element.
7.      Access the selection object from following Class type, else you will not be able to get the property details.
1.      Single child selection type = Shape.
2.      Multiple child selection type = ShapeRange.
3.      No Child Selection type = GroupObject.
0
 
ljw2006Commented:
Is there an updated answer to this question?
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now