Microsoft Visio 2010 Developer Training



Microsoft Visio 2010 Developer TrainingVolume 2: Solutions and PublishingDISCLAIMER? 2010 Microsoft Corporation. All rights reserved. Microsoft?, Internet Explorer, and Windows? are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.The names of actual companies and products mentioned herein may be the trademarks of their respective owners.The contents of this package are for informational and training purposes only and are provided "as is" without warranty of any kind, whether express or implied, including but not limited to the implied warranties of merchantability, fitness for a particular purpose, and non-infringement.No part of the text or software included in this training package may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission from Microsoft?. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication. The names of actual companies and products mentioned herein may be the trademarks of their respective owners.To obtain authorization for uses other than those specified above, please visit the Microsoft Copyright Permissions Web page at This content is proprietary and confidential, and is intended only for users described in the content provided in this document. This content and information is provided to you under a Non-Disclosure Agreement and cannot be distributed. Copying, disclosing all or any portion of the content and/or information included in this document is strictly prohibited.Table of Contents TOC \o "1-3" \h \z \u Built in Solutions PAGEREF _Toc253091538 \h 6Process Management PAGEREF _Toc253091539 \h 7The Subprocess ribbon group PAGEREF _Toc253091540 \h 7The Diagram Validation ribbon group PAGEREF _Toc253091541 \h 10The SharePoint Workflow ribbon group PAGEREF _Toc253091542 \h 26Process Management Additional Resources PAGEREF _Toc253091543 \h 29Creating Visio Process Diagrams PAGEREF _Toc253091544 \h 29Validating Visio Drawings PAGEREF _Toc253091545 \h 29SharePoint Workflows PAGEREF _Toc253091546 \h 30Linking Drawings using the Database Wizard PAGEREF _Toc253091547 \h 31Overview PAGEREF _Toc253091548 \h 32Database Concepts PAGEREF _Toc253091549 \h 33Database Concepts (Continued) PAGEREF _Toc253091550 \h 34Data Types PAGEREF _Toc253091551 \h 35Visio Cell Values and Formulas PAGEREF _Toc253091552 \h 36Connections to Visio SmartShapes PAGEREF _Toc253091553 \h 37The Link to ODBC Database Add-on PAGEREF _Toc253091554 \h 38Database Actions and Activities PAGEREF _Toc253091555 \h 40The Export to Database Add-on PAGEREF _Toc253091556 \h 41Lab 2.1 Export Shape Data to Database PAGEREF _Toc253091557 \h 42Summary: Linking Visio Drawings to a Database PAGEREF _Toc253091558 \h 43Organization Chart Solution PAGEREF _Toc253091559 \h 44Overview PAGEREF _Toc253091560 \h 45Creating organization charts in Visio PAGEREF _Toc253091561 \h 46Organization Chart Menu PAGEREF _Toc253091562 \h 47Organization Chart Menu (cont.) PAGEREF _Toc253091563 \h 49Organization Chart Reporting PAGEREF _Toc253091564 \h 50Lab 2.2: Exploring the organization chart user interface PAGEREF _Toc253091565 \h 51Organization Chart Wizard PAGEREF _Toc253091566 \h 53Data file structure PAGEREF _Toc253091567 \h 54Tips on using the Organization Chart Wizard PAGEREF _Toc253091568 \h 55Running the organization chart solution in “silent” mode PAGEREF _Toc253091569 \h 57Lab 2.3: Running the wizard in “silent” mode PAGEREF _Toc253091570 \h 62Summary: Visio Organization Chart Solution PAGEREF _Toc253091571 \h 63Pivot Diagrams PAGEREF _Toc253091572 \h 64Conceptual Overview PAGEREF _Toc253091573 \h 64Try it! Pivot Diagram PAGEREF _Toc253091574 \h 67Exploring Drill-down PAGEREF _Toc253091575 \h 81Collapsing and Merging nodes PAGEREF _Toc253091576 \h 91Promote Nodes to Root PAGEREF _Toc253091577 \h 92Lab 2.4: Pivot Diagram – Filter a Sales database to analyze business information PAGEREF _Toc253091578 \h 92Built in Solutions Review PAGEREF _Toc253091579 \h 95Publishing Diagrams PAGEREF _Toc253091580 \h 97Visio Services PAGEREF _Toc253091581 \h 98Publishing Diagrams to Visio Services PAGEREF _Toc253091582 \h 100Integrating Visio drawings into SharePoint Applications PAGEREF _Toc253091583 \h 105Visio Services Additional Resources PAGEREF _Toc253091584 \h 125Publishing and viewing Visio Solutions PAGEREF _Toc253091585 \h 126Publish for visualization only PAGEREF _Toc253091586 \h 130Lab 2.5: Exporting to other formats PAGEREF _Toc253091587 \h 141Publish for visual data PAGEREF _Toc253091588 \h 141Publish for data only PAGEREF _Toc253091589 \h 151Manage Visio files with SharePoint? Technologies PAGEREF _Toc253091590 \h 151Publishing Review PAGEREF _Toc253091591 \h 158Deploying Visio Solutions PAGEREF _Toc253091592 \h 160Deploy a Visio library solution PAGEREF _Toc253091593 \h 163Deploy a Visio automation solution PAGEREF _Toc253091594 \h 165Deploy solutions for use with multiple languages PAGEREF _Toc253091595 \h 166Deploy a Windows Forms solution that contains the Visio Viewer control PAGEREF _Toc253091596 \h 169Additional Resources PAGEREF _Toc253091597 \h 170Deploying Solutions Review PAGEREF _Toc253091598 \h 172Some Important Developer Features PAGEREF _Toc253091599 \h 174Theme colors and theme effects PAGEREF _Toc253091600 \h 175User issues PAGEREF _Toc253091601 \h 175Developer issues PAGEREF _Toc253091602 \h 179Trust Center and Remove Hidden Information PAGEREF _Toc253091603 \h 187Macro Recorder considerations PAGEREF _Toc253091604 \h 191XML changes for Visio 2007 PAGEREF _Toc253091605 \h 192XML Schema Changes PAGEREF _Toc253091606 \h 192XMLLite PAGEREF _Toc253091607 \h 195Additional Resources PAGEREF _Toc253091608 \h 197Developer Features Review PAGEREF _Toc253091609 \h 201Built in SolutionsThere are many solution components included with Visio. Some of the common ones will be explored in this module: process management and drawing validation, database linking using the database wizard, organization chart solution, and creating pivot diagrams. Module ObjectivesAfter completing this module you will be able to:Create and validate process flow diagramsCreate custom rules for validating drawingsCreate SharePoint Workflow diagramsLink Visio shapes or masters to an ODBC compliant datasource. Read and write data to a linked datasource.Use the Organization chart wizard to create diagrams from data stored externally to Visio.Use the many features of the organization chart user interface.Create pivot diagrams and use them to explore and analyze data.Process ManagementSimplifying Processs Management was a major focus of enhancements for Visio 2010. The techniques used to create process diagrams can vary greatly from user to user and process diagrams can range from being fairly simple to being very complex. A common method is to break a complex diagram down into manageable pieces by separating parts of the diagram across different pages and even across different documents.To build the diagrams some users start with a bottom up approach while others build their diagrams top down. Visio 2010 makes it easier to take either approach: whether you detail out a sub process on its own page and then reference it from a high level diagram or whether you detail out the process at the top level and break out portions of the drawing into sub processes after they are developed. Visio 2010 adds explicit support to create new sub processes and reference existing ones. Note: The Process tab is only available in the Premium version of Visio 2010.Below is a view of the Process ribbon in Visio 2010.? The Subprocess ribbon groupItems from the Subprocess group are used in constructing diagrams with sub processes. These sub processes may be on different pages in the same document or in different documents. Hyperlinks are created automatically when creating sub processes so that the overall process flow can be followed easily.The Create New process is used to build out a new sub process represented by a selected shape. The Create New ribbon item is not enabled if there is no shape selected. When selected, this will insert a new blank page and add the page name and a hyperlink pointing to the new page from the selected shape. Below is a snippet of automation code that does the same thing as the Create New command.Sub CreateFromShape() 'Enable diagram services Dim DiagramServices As Integer DiagramServices = ActiveDocument.DiagramServicesEnabled ActiveDocument.DiagramServicesEnabled = visServiceVersion140 'Create a sub process from the first selected shape ActiveWindow.selection(1).CreateSubProcess 'Restore diagram services ActiveDocument.DiagramServicesEnabled = DiagramServicesEnd Sub Note: Microsoft Visio 2010 introduces two new sets of diagram behaviors: structured-diagram behaviors and AutoSize behaviors. Structured-diagram behaviors define when container-membership relationships and callout associations are created. AutoSize behaviors define when Visio automatically resizes the drawing page to adjust to changes in its contents.Custom solutions can take advantage of these behaviors by using the DiagramServicesEnabled property to enable the desired services. When a custom solution modifies a diagram, Visio invokes the diagram behaviors associated with any of the services currently enabled.Setting DiagramServicesEnabled=visServiceVersion140 setss all diagram services that exist in Visio 2010.The CreateSubProcess method of the shape creates a new sub process page and links it to the selected shape.If the sub process has already been diagramed, the Link to Existing command allows you to create a hyperlink on a selected shape to either a page in the current document or to an external document. Link to Existing can also be used to edit existing hyperlinks. Choose Link to Existing > Edit Link… to display the Hyperlinks dialog.The Create from Selection command is used when you want to move a number of shapes from your current page onto a new sub process page.? Visio adds a new page, moves the selected shapes to the new page and adds a sub process shape to the current page.? Figure 1 - Selected shapes are moved to a new pageFigure 2 - The selected shapes are replaced with a new shapeThe new shape represents the new sub process and contains the name of the new page as well as a hyperlink pointing to it. The code snippet below does this through automation. Note that the selection is first saved because when a new page is created any currently selected shapes are lost. After the new page is created, the MoveToSubProcesss method of the saved selection is used to move the selection to the new page and to drop and link a replacement shape onto the page that replaces the selection. The second parameter of the MoveToSubProcess method is Nothing. This tells Visio to use the default shape as the replacement shape.Sub MoveToSubProcess() 'Enable diagram services Dim DiagramServices As Integer DiagramServices = ActiveDocument.DiagramServicesEnabled ActiveDocument.DiagramServicesEnabled = visServiceVersion140 'save the selection since it will be lost when the new page is created Dim selection As Visio.selection Set selection = ActiveWindow.selection 'create a new page for the sub process Dim newPage As Visio.Page Set newPage = ActiveDocument.Pages.Add 'move the sub process to the new page selection.MoveToSubProcess newPage, Nothing 'Restore diagram services ActiveDocument.DiagramServicesEnabled = DiagramServicesEnd SubThe Diagram Validation ribbon groupProcess > Check Diagram is a new feature to validate a drawing based on rules that are stored within the drawing. This feature can be used to check for common errors such as connectors not being glued or flowchart shapes without the correct number of incoming and outgoing connectors.Rule sets are stored in document templates and are included in the Visio provided templates Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation. A rich validation object model and corresponding API enable one to create custom solutions that add and delete rules, validate drawings with the new rules, detect the Validation events, and manage validation issues.As seen in the object model diagram below, a ValidationRule is part of a collection of ValidationRules. A ValidationRuleSet combines the ValidationRules collection along with a Description and Enabled flag. In Visio’s Process tab choose Check Diagram and then Rules to Check. Each item listed is a rule set. If the rule set’s Enabled flag is set, then this rule set is checked in the menu and will be applied to the current drawing when Check Diagram is chosen. Using the Visio development API one can create custom rule sets to capture specific corporate needs. Note: Rules stored in a drawing can be viewed easily by saving the Visio drawing as a .vdx file and then searching the resulting XML file for “validation”. It is possible to edit the XML directly, but it is recommended that the provided API be used instead.Defining ValidationRule.FilterExpression and ValidationRule.TestExpressionWhen you validate a diagram by calling the Validation.Validate method or by clicking Check Diagram on the Process tab, Visio will automatically use any validation logic stored in the document to detect errors. This validation logic is expressed in the ValidationRule.TargetType, ValidationRule.FilterExpression and ValidationRule.TestExpression properties. The FilterExpression and TestExpression should be written as Boolean expressions that can be evaluated on every object of type TargetType. During validation of a rule, for every object of type TargetType, Visio uses the FilterExpression to determine whether the object must satisfy the validation rule. If the filter expression evaluates to True, Visio uses the TestExpression to determine whether to generate an issue for the object. If the filter expression evaluates to False, Visio does not apply the validation rule to the object. The syntax for the FilterExpression and TestExpression properties are the same as that of a ShapeSheet expression. For example, since NOT(IS1D()) is a valid Boolean expression for the ShapeSheet of a shape, "NOT(Is1D())" is a valid FilterExpression or TestExpression for a validation rule with TargetType = Visio.VisRuleTargets.visRuleTargetShape. In addition to the standard ShapeSheet functions, the following validation functions can be used in a FilterExpression or TestExpression.Function Description Role() Returns an integer indicating the shape role: {Element = 0, Connector = 1, Container = 2, Callout = 4}. OnLayer(LayerName) Returns a Boolean indicating whether the shape is a member of the specified layer. Returns a Boolean indicating whether layer exists on page if called on a Page. ConnectedShapes(Direction) Returns the set of shapes, matching the Direction criteria, connected to the shape. GluedShapes(Direction) Returns the set of shapes, matching the Direction criteria, glued to the shape. ContainerMembers() Returns the set of shapes that are members of the container / list shape. ListMembers() Returns the set of shapes that are members of the list shape. Callouts() Returns the set of shapes that are callouts on the shape. ParentContainers() Returns the set of containers that the shape belongs to. ShapesOnPage() Returns the set of top-level shapes on page. If no page specifier precedes the function, the shape’s containing page is assumed. AggCount(Set) Counts the number of shapes in a set. FilterSet(Set,FilterExpression) Returns the subset of shapes in a set that match an expression. OnBoundaryOf() Returns the set of containers such that the shape is on the boundary of these containers. The validation expression functions ConnectedShapes and GluedShapes correspond to connectivity API functions with the same names. Similarly, the possible values of the Direction input parameter for ConnectedShapes and GluedShapes correspond to the VisConnectedShapesFlags and VisGluedShapesFlags enumerations, respectively.An Example: The Rule Set for the basic flowchart templateTo get a better understanding of how a rule set is structured, let’s examine in detail the rule set provided with Visio 2010 for checking flowcharts. One cannot see the actual rules using the Visio user interface. However, a quick way to see how the rule objects are set up is to save a drawing that contains rules (such as a flowchart) as a .vdx file and then view it using an XML viewer such as XML Notepad. The image below shows a small portion of the file beginning with the Validation section through the first of eleven rules. ValidationRuleSet ObjectThe RuleSet is an object that holds a collection of rulesID: 1NameU : FlowchartDescription: Verify that Flowchart shapes are connected properly.NameU is the universal name of the ValidationRuleSet object and Description states the purpose of the ValidationRuleSet object. There are eleven rules defined within this ValidationRuleSet.ValidationRule ObjectsNameU is the universal name of the Rule object.Category represents the text displayed in the Category column of the Issues window.Description states the purpose of the ValidationRule object.RuleTarget represents the TargetType property of the ValidationRule object. Rules can be targeted at the shape, page, or document level.=0. The rule applies to shapes in the document.=1. The rule applies to pages in the document.=2. The rule applies to the document itself.RuleFilter in the .vdx file is the FilterExpression property of the ValidationRule object. This defines a logical expression that determines whether the validation rule should be applied to a target object.When you validate a diagram by calling the Validate method or by clicking Check Diagram on the Process tab, Visio uses the expression that you set as the FilterExpression property value to determine whether a target object must satisfy the validation rule. If the filter expression evaluates to True, Visio uses the TestExpression property value to determine whether to generate an issue for the target object. If the filter expression evaluates to False, Visio does not apply the validation rule to the target object during validation. The syntax for the FilterExpression property value is the same as that for a ShapeSheet expression. When you set the FilterExpression property, Visio does not validate the syntax of the filter expression. If the expression is not syntactically correct, Visio does not apply the validation rule to the target object during validation.RuleTest in the .vdx file is the TestExpression property value of the ValidationRule object.The syntax for the TestExpression property value is the same as that for a ShapeSheet expression. When you set the TestExpression property value, Visio does not check the syntax of the test expression. If the test expression is not syntactically correct, the evaluation of the expression fails during validation and Visio generates a validation issue at that time.The default property values of a validation rule are as follows: Category = [empty]Description = "Unknown"FilterExpression = [empty] Ignored = FalseTargetType = visRuleTargetShapeTestExpression = [empty]Parsing the rules for the flowchart templateThe following tables show the eleven rules defined within the flowchart template for checking basic flowchart diagrams.Rule #1ID1NameUUngluedConnectorCategoryConnectivityDescriptionConnector is not glued at both ends.RuleFilterROLE()=1RuleTestAND(AGGCOUNT(GLUEDSHAPES(4)) = 1, AGGCOUNT(GLUEDSHAPES(5)) = 1)The rule checks that a connector is glued at both ends. ROLE()=1 as the RuleFilter expression means to select all connector shapes.GLUEDSHAPES is a shape method that returns an array that contains the identifiers of the shapes that are glued to a shape. The method takes a flag that specifies the dimensionality and directionality of the connection points of the shapes to be returned. The flag parameter options are itemized in visGluedShapesFlags enumeration:visGluedShapesIncoming2D=4. If the source object is a 1D shape, return the 2D shape to which the begin point is glued.visGluedShapesOutgoing2D=5. If the source object is a 1D shape, return the 2D shape to which the end point is glued. AGGCOUNT counts how many shapes are returned by the GLUEDSHAPES method.In words, the RuleFilter says to look at all connector shapes. For each connector shape found check that the begin point is glued to exactly one 2D shape and the end point is glued to exactly one 2D shape.Rule #2ID2NameUStartWithoutTerminatorCategoryStart / EndDescriptionFlowchart shape has no incoming connectors and is not a Start/End shape.RuleFilterAND(OR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart")),NOT(OR(HASCATEGORY("Start/End"),STRSAME(LEFT(MASTERNAME(750),9),"Start/End"),STRSAME(LEFT(MASTERNAME(750),10),"Terminator"))))RuleTestAGGCOUNT(GLUEDSHAPES(1)) > 0This somewhat complex looking RuleFilter is expressed below with some added indentation to aid in understanding.AND(OR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart") ),NOT(OR(HASCATEGORY("Start/End"),STRSAME(LEFT(MASTERNAME(750),9),"Start/End"),STRSAME(LEFT(MASTERNAME(750),10),"Terminator") ) ) )The shape has to either have the Flowchart category defined, HASCATEGORY(“Flowchart”), meaning there is a ShapeSheet cell User.msvShapeCategories=”Flowchart”, or the shape is on the “Flowchart” layer.The shape must also not have a cell User.msvShapeCategories=”Start/End”, not be created from the “Start/End” master and not be created from a “Terminator” master. MASTERNAME is a ShapeSheet function that returns a shape’s master name as a string. The argument is used to specify a language for the string the function returns. Use a value of 0 (default value) to specify the local language. Use 750 to specify universal language.If the shape satisfies these RuleFilter conditions, then the FilterExpresssion is applied. GLUEDSHAPES(1) returns a list of 1D shapes whose end points are glued to this shape. AGGCOUNT(GLUEDSHAPES(1))>0 states that the target shape must therefore have at least one incoming connector.Rule #3ID3NameUEndWithoutTerminatorCategoryStart / EndDescriptionFlowchart shape has no outgoing connectors and is not a Start/End shape.RuleFilterAND(OR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart")),NOT(OR(HASCATEGORY("Start/End"),STRSAME(LEFT(MASTERNAME(750),9),"Start/End"),STRSAME(LEFT(MASTERNAME(750),10),"Terminator"))))RuleTestAGGCOUNT(GLUEDSHAPES(2)) > 0The RuleFilter is identical to that of rule #2. GLUEDSHAPES(2) returns a list of 1D shapes whose begin points are glued to this shape. AGGCOUNT(GLUEDSHAPES(2))>0 states that the target shape must therefore have at least one outgoing connector.Rule #4ID4NameUNoStartTerminatorCategoryStart / EndDescriptionFlowchart does not start with a Start/End shape.RuleTarget1RuleFilterAGGCOUNT(FILTERSET(SHAPESONPAGE(), "OR(HASCATEGORY(""Flowchart""),ONLAYER(""Flowchart""))")) > 0RuleTestAGGCOUNT(FILTERSET(SHAPESONPAGE(), "AND(OR(HASCATEGORY(""Start/End""),STRSAME(LEFT(MASTERNAME(750),9),""Start/End""),STRSAME(LEFT(MASTERNAME(750),10),""Terminator"")),AGGCOUNT(CONNECTEDSHAPES(2))>0)")) > 0RuleTarget=1 sets the target of this rule to be the page. When no RuleTarget is specified, the default is to target shapes.The RuleFilter filters the collection of all shapes on the page, SHAPESONPAGE(), to include only those shapes that are either assigned to the “Flowchart” category, HASCATEGORY(“Flowchart”), or have been assigned to a Flowchart layer. The AGGCOUNT function is used to check that the count in this collection is >0.The RuleTest is shown below with indentation added for easier interpretation.AGGCOUNT(FILTERSET( SHAPESONPAGE(), "AND(OR(HASCATEGORY(""Start/End""), STRSAME(LEFT(MASTERNAME(750),9),""Start/End""), STRSAME(LEFT(MASTERNAME(750),10),""Terminator"")),AGGCOUNT(CONNECTEDSHAPES(2))>0)")) > 0The innermost portion OR(HASCATEGORY(""Start/End""), STRSAME(LEFT(MASTERNAME(750),9),""Start/End""), STRSAME(LEFT(MASTERNAME(750),10),""Terminator"")),specifies that the shape must either be defined with category “Start/End”, i.e., it has msvShapeCategories=”Start/End”, or it is derived from a master named Start/End or it is derived from a master named Terminator.CONNECTEDSHAPES(2) is a shape method that returns a list of shapes connected to the shape which are associated with outgoing connectors.AGGCOUNT(CONNECTEDSHAPES(2))>0 says there must be at least one shape connected with an outgoing connector.FILTERSET selects all SHAPESONPAGE and then filters these shapes to include only those that are start or end terminator shapes which also have at least one outgoing connector. The outer most AGGCOUNT checks that at least one shape satisfies these conditions.In summary the rule checks for at least one Start/End or Terminator shape that has outgoing connectors that are connected to something.Rule #5ID5NameUNoEndTerminatorCategoryStart / EndDescriptionFlowchart does not end with a Start/End shape.RuleTarget1RuleFilterAGGCOUNT(FILTERSET(SHAPESONPAGE(), "OR(HASCATEGORY(""Flowchart""),ONLAYER(""Flowchart""))")) > 0RuleTestAGGCOUNT(FILTERSET(SHAPESONPAGE(), "AND(OR(HASCATEGORY(""Start/End""),STRSAME(LEFT(MASTERNAME(750),9),""Start/End""),STRSAME(LEFT(MASTERNAME(750),10),""Terminator"")),AGGCOUNT(CONNECTEDSHAPES(1))>0)")) > 0The rule is identical to rule #4 except that CONNECTEDSHAPES(1) returns a list of shapes connected to the shape which are associated with incoming connectors. Thus the rule checks for at least one terminating shape with incoming connectors that are connected to something.Rule #6ID6NameUUnconnectedShapeCategoryConnectivityDescriptionFlowchart shape is not connected to any other shape.RuleFilterOR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart"))RuleTestAGGCOUNT(CONNECTEDSHAPES(0)) > 0The RuleFilter looks for shapes that have category “Flowchart” or are on a “Flowchart” layer.The shape must be connected to at least one other shape. CONNECTEDSHAPES(0) returns a list of shapes connected to the shape via either incoming or outgoing connections.Rule #7ID7NameUTerminatorInMiddleCategoryConnectivityDescriptionStart/End shape has both incoming and outgoing connectors.RuleFilterOR(HASCATEGORY("Start/End"),STRSAME(LEFT(MASTERNAME(750),9),"Start/End"),STRSAME(LEFT(MASTERNAME(750),10),"Terminator"))RuleTestNOT(AND(AGGCOUNT(CONNECTEDSHAPES(1))>0,AGGCOUNT(CONNECTEDSHAPES(2))>0))The RuleFilter finds terminator shapes by checking msvShapeCategories=”Start/End” or shapes that inherit from master “Start/End” or from master “Terminator”.The RuleText counts both incoming connectors (CONNECTEDSHAPES(1)>0) and outgoing connectors (CONNECTEDSHAPES(2)>0). A terminator should not have both incoming and outgoing connectors. Rule #8ID8NameUTooFewOutConnsCategoryConnectivityDescriptionDecision shape should have more than one outgoing connector.RuleFilterOR(HASCATEGORY("Decision"),STRSAME(LEFT(MASTERNAME(750),8),"Decision"))RuleTestAGGCOUNT(GLUEDSHAPES(2)) > 1The RuleFilter checks for shapes that either have a cell msvShapeCategories=”Decision” or are derived from a master named “Decision”.GLUEDSHAPES(2) returns a list of 1D shapes whose begin points are glued to this shape. AGGCOUNT(GLUEDSHAPES(2))>0 states that the Decision shape must therefore have more than one outgoing connector.Rule #9ID9NameUNonFlowchartShapeCategoryConnectivityDescriptionConnected shape is not recognized as a Flowchart shape.RuleFilterNOT(OR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart")))RuleTestAGGCOUNT(GLUEDSHAPES(0)) = 0The RuleFilter checks for shapes that do not have a cell msvShapeCategories=”Flowchart” and are not on a layer named “Flowchart”.Any shapes found by the RuleFilter are checked. GLUEDSHAPES(0) returns a list of all 1D shapes that are glued to this shape. AGGCOUNT(GLUEDSHAPES(0))=0 states that the shape has no glued shapes. Therefore, a validation issue is raised only if there is a non flowchart shape that is glued to something else. A non flowchart shape can exist in the drawing without raising a validation issue as long as it is not glued to another shape.Rule #10ID10NameUNoShapeTextCategoryTextDescriptionFlowchart shape has no text label.RuleFilterOR(HASCATEGORY("Flowchart"),ONLAYER("Flowchart"))RuleTestNOT(STRSAME(SHAPETEXT(TheText), ""))The RuleFilter checks for “Flowchart” shapes either defined by category or assigned to a layer.The RuleTest compares the shape text to the null string. Therefore, any flowchart shape raises an issue if it has no text.Rule #11ID11NameUOutsideCFFCategoryCross - FunctionalDescriptionFlowchart shapes should belong to a Swimlane.RuleTarget1RuleFilterAGGCOUNT(FILTERSET(SHAPESONPAGE(),"HASCATEGORY(""Swimlane"")"))>0RuleTestAGGCOUNT(FILTERSET(SHAPESONPAGE(),"AND(OR(HASCATEGORY(""Flowchart""),ONLAYER(""Flowchart"")),AGGCOUNT(FILTERSET(PARENTCONTAINERS(),""HASCATEGORY(""""Swimlane"""")""))=0)"))=0The last rule is a page level check (RuleTarget=1).The RuleFilter gets all Swimlane shapes. If there are no swimlanes on the page, this rule has no effect.If there are swimlanes on the page the RuleTest checks to see that all Flowchart shapes are within a swimlane. The RuleTest is displayed below with indentation for easier interpretation.AGGCOUNT( FILTERSET( SHAPESONPAGE(), "AND(OR(HASCATEGORY(""Flowchart""),ONLAYER(""Flowchart"")), AGGCOUNT(FILTERSET(PARENTCONTAINERS(), ""HASCATEGORY(""""Swimlane"""")""))=0)"))=0The outer FILTERSET selects all SHAPESONPAGE and filters these to include only shapes that are Flowchart shapes (which have either the Flowchart category defined or are on a Flowchart layer) AND whose PARENTCONTAINERS are in the Swimlane category. If any flowchart shape does not have a swimlane parent, the outer ADDCOUNT will be greater than 0.Custom validation rules and rule setsThere are two main approaches to creating custom validation rules and rule sets.You can write validation rules and validation logic that will be stored in a custom Visio template. These rules are automatically available to users that create diagrams based on this template. When a user clicks Check Diagram on the Process tab, Visio uses the validation logic provided to determine whether the diagram has issues. In Visio 2010, this technique is used for the Basic Flowchart, Cross Functional Flowchart and Business Process Modeling Notation templates. You can also write validation logic in code and deploy this logic as part of a Visio solution. For this approach, the solution code listens for the appropriate RuleSetValidated event and uses its own logic to determine the list of issues to add to the document. In Visio 2010, this technique is used for the Microsoft SharePoint Workflow template. Adding custom validation rules to a templateCustom rules can be created to add to the existing rules provided with Visio or completely new rule sets can be created.The following macro shows how to create a custom rule set. This rule set has two rules. The first tests that Process shapes have exactly one outgoing connector. The second rule tests that Decision shapes have more than 1 outgoing connector.Sub AddPicayuneRules() Dim RuleSet As Visio.ValidationRuleSet Dim rule As Visio.ValidationRule 'Add a new RuleSet Set RuleSet = ThisDocument.Validation.RuleSets.Add("Picayune Rules") RuleSet.Description = "Verify that the Picayune rules are followed" RuleSet.Enabled = True RuleSet.RuleSetFlags = visRuleSetDefault 'Rule 1: Checks that process shapes have exactly one outgoing connector Set rule = RuleSet.Rules.Add("WrongNumConn") rule.Category = "Connectivity" rule.Description = "Process shape should have one outgoing connector" rule.TargetType = visRuleTargetShape rule.FilterExpression = "OR(HASCATEGORY(""Process""),STRSAME(LEFT(MASTERNAME(750),7),""Process""))" rule.TestExpression = "AGGCOUNT(CONNECTEDSHAPES(2)) = 1" 'Rule 2: Checks that decision shapes have more than one outgoing connector Set rule = RuleSet.Rules.Add("TooFewOutConns") rule.Category = "Connectivity" rule.Description = "Decision shape should have more than one outgoing connector" rule.TargetType = visRuleTargetShape rule.FilterExpression = "OR(HASCATEGORY(""Decision""),STRSAME(LEFT(MASTERNAME(750),8),""Decision""))" rule.TestExpression = "AGGCOUNT(CONNECTEDSHAPES(2)) > 1"End SubWhether the rules are created via a macro as is done in the above example or imported into a drawing using the Check Diagram > Import Rules From option, the drawing can be saved as a template. Then when new drawings are created from this template the custom rules that were saved with the template can be applied to the new drawing.Adding validation logic in codeIf you save a Microsoft SharePoint Workflow diagram as an XML Drawing (*.vdx) and open the XML Drawing in an XML editor, you will see that there is no logic in the RuleFilter and RuleTest expressions. In this case, the solution contains code with the validation logic. The SharePoint Workflow solution listens for the SharePoint Workflow RuleSetValidated event, and, when this event occurs, it scans the diagram to determine if there are issues. When an issue is found, it uses the validation API to add the issue to the document. Visio automatically displays these issues in the Issues Window.Summary of options available for utilizing validation logicEnd-users and companies can use the default rules provide in Visio 2010 to check their diagrams for issues and ensure diagram consistency. Out-of-the box support is included for Basic Flowchart, Cross Functional Flowchart, Microsoft SharePoint Workflow and Business Process Modeling Notation diagrams.Developers can extend the out-of-box support by creating custom templates with validation rules. These rules are available to users who create diagrams from these templates.Developers can create Visio solutions that listen for the validation event. When the Check Diagram button is clicked, the solution can run code to validate complex logic and use the validation API to add issues to the list of issues displayed in the Issues Window. Developers can create Visio solutions that trigger validation from within their code. This allows solutions to make use of validation without relying on a click of the Check Diagram button. For example, the Microsoft SharePoint Workflow template triggers validation when a user clicks the SharePoint Workflow button Export on the Process tab.Managing validation issuesWhen using Check Diagram to verify a process Visio will either tell you there are no problems with the diagram or display a list of issues in the Issues Window. Each problem that occurs raises a Validation Issue that is displayed in the Issues Window. Each issue displays the Description and the Category from the rule that has been violated and the page that the problem occurs on if there are multiple pages in the drawing. Selecting an issue in the Issues Window automatically selects the shape that is the target of that issue.Once an issue is fixed, choose Check Diagram again to verify that there are no remaining problems.Sometimes you may find that an issue does not apply to a certain shape in the drawing. When this occurs, you can ignore the issue and Visio will not display it in the Issues window. If a rule does not apply to an entire document, you can also ignore the rule so that no issues associated with that rule are displayed. To ignore an issue or a rule, right-click the issue in the Issues Window and select the appropriate command. If ignored, the issues are removed from display in the Issues window. Any ignored issues can be redisplayed at any time.To create issues programmatically, use the Rule.AddIssue method. The issue will automatically be displayed in the Issues window. Use ValidationIssue.Delete to delete an individual issue or use ValidationIssues.Clear to remove all issues.The SharePoint Workflow ribbon groupBeginning with SharePoint Server 2007 users have been able to create workflows that can be executed in SharePoint. Beginning with Visio 2010 users can now use Visio’s visual interface for creating the initial workflow before exporting it to SharePoint Designer for further editing before it becomes the final workflow executable in SharePoint.A SharePoint workflow is just another type of process flow so it lends itself well to being created initially in Visio. In SharePoint there are predefined common activities such as “Send an email”, “Assign item for feedback”, and “Assign item for approval”. Visio captures each of these standard SharePoint activities in the form of shapes in a stencil which are used to create the workflow drawing in Visio. To create the workflow in Visio, simply drag and drop shapes and connect the shapes just as you would any other Visio flow diagram. And Visio’s Check Diagram feature can be used to validate the workflow before exporting it to SharePoint designer. Note: Visio will automatically check the workflow diagram before exporting. Visio will not allow invalid diagrams to be exported.Try it! Create a SharePoint Workflow diagramCreate a new drawing in Visio by choosing File > New > Flowchart > Microsoft SharePoint Workflow. Note that there are three stencils opened with the template: SharePoint Workflow Actions, SharePoint Workflow Conditions, and SharePoint Workflow Terminators.Create the following diagram.Validate the drawing using Process > Check Diagram. The Issues Window should look like the following.Select the issue in the Issues Window. The problem shape (a connector shape) will be selected. Add the text “Yes” to the connector.Validate the drawing again and fix any remaining issues.Try it! Export the validated workflowChoose Export from the Process SharePoint Workflow group.Choose a location and save the file. The exported file is saved as a Visio Workflow Interchange file (.vwi).So that we may examine the file further, change the extension from .vwi to .zip.Open the .zip file. Note that there are four files embedded in the .vwi file.[ContentTypes].xml – this file stores a list of the file extensions of the files embedded in the .vwi file.Workflow.vdx – the Visio drawing file in XML format.Workflow.xoml – an XML representation of the workflow. This includes all conditions, activities, and their parameters. SharePoint Workflow Designer uses this file to retrieve the workflow logic and the values for each condition and activity.Workflow.xoml.rules – defines the rules used when checking the workflow for errors.Process Management Additional ResourcesCreating Visio Process DiagramsVideo: Process Diagrams in Visio 2010 and Hyperlinks support in Visio 2010 Developer Center Parker’s blogDavid is a Visio MVP who blogs regularly on a variety of features of Visio. Visio DrawingsDiagram Validation in Visio 2010 custom validation rules in Visio 2010 WorkflowsSharePoint Workflow Authoring in Visio Premium 2010 (Part 1) Workflows for SharePoint 2010 with Visio 2010 Visio Graphics Services within SharePoint Designer 2010 Workflows SharePoint 2010 Workflows in Visio 2010 and SharePoint Designer Workflows Drawings using the Database WizardOverviewPart of the power behind Visio is its ability to communicate with other applications. In this module you will learn about connecting Visio to databases using the Database Wizard. In another module we will cover the Visio feature called Data Linking. That is a distinct feature from the Database Wizard. As you cover this material, keep in mind that Visio has no direct interface into a database. All database communications are being handled via an ODBC OLE Controller. You can link the data that resides in a particular master shape or instance of a master shape to a database via the transparent ODBC interface. Visio’s Database capabilities can automate this process for you. These include the Link to Database Add-on, the Export to Database Add-on and the Database Wizard. They will link the values of a ShapeSheet’s Shape Data section’s selected rows to a database created in an application compliant with the ODBC standard. If the database is revised once the linkage is established, you can refresh the values in the ShapeSheet cells to reflect the revisions. If you change the value of a linked Shape Data cell in Visio, you can update the database to reflect the changes.This section covers techniques for linking shapes to ODBC compliant sources. It explores the following concepts in some detail:General concepts for working with databases.The kind of information that can be stored in Visio ShapeSheet cells.The steps to follow to successfully connect the database to a Visio shape.The particular actions and activities that the user can use once the linkage is complete.The steps to follow to successfully export shape data to a file.Database ConceptsA database is a repository for information. In this section, we are concerned with two general classes of databases: flat files and relational databases.Flat files are effectively spreadsheets of information. Each column heading in a spreadsheet is the same as a field definition in the database. Each row in the spreadsheet is the same as a record entry in the database.Relational databases are more complex. A given table may have a field item that is an index into another table, which stores further information relating to that indexed item.A table is comprised of numerous field definitions. Each field definition has its own data type.Each table definition also contains one or more key fields. Key fields are unique indexable items that assist in locating information as well as querying and sorting the information contained in the table.Database Concepts (Continued)In order for a linkage to be established between Visio and a database, several items must be established and properly initialized.A named data source must be created. This named data source is any ODBC compliant data source such as Access, Microsoft Excel, SQL Server, Oracle, and many others. These data sources must be initialized via the 32-bit ODBC system and given a valid source name.The actual database (such as Dbsample.mdb) must be specified.The table or query within the database must be identified. The primary key field(s) in the record must be identified.Finally, the particular record in the selected table or query must be identified.Data TypesVisio’s Shape Data section is capable of storing several data types, but Visio stores data that resides in Shape Data Value cells (and in all Visio ShapeSheet cells) in one of two general manners: as Formulas or as Values.Formulas are always stored as strings. These strings can be up to 64K in size, and as you will see in a moment, these strings can evaluate to numerous data types.Values, on the other hand, are stored in many different possible modes. These modes are:StringsNumbersBoolean ValuesBinary DataNumbers can be stored as:NumbersCurrencyDatesTimesBoolean values always hold either a TRUE or FALSE value.Binary data is kept in native binary format.Visio Cell Values and FormulasAs you know, in Visio ShapeSheet cells, information may be stored either as values or as formulas. The cell values and formulas are handled in slightly differing manners as they relate to database connectivity.When information is stored as a value, it may be thought of as taking on one of several forms: “Unit-ed” or “Unit-less” numbers, strings, or Booleans. A “Unit-ed” cell contains values that are number + unit pairs, as in 3.5 in., or 26.825 cm. This represents a scalar distance or vector information. A “Unit-less” cell contains values, which are numbers only, as in 16, or 3.1415926. A string is simply a piece of text, such as “Network Router.” Note: In the ShapeSheet, a piece of text is surrounded by double-quotation marks, which designate the text as a string.A Boolean is simply a non-quoted string as TRUE or FALSE only.When information is stored as formulas, Visio and its database functionality can work the formula in one of two differing manners: either as an interpreted string or as a non-interpreted string. See FORMAT() and FormatResult in the developer reference section for further discussions on string interpretation.Connections to Visio SmartShapesWhen the Link to ODBC Database Add-on is run, it will allow the user to connect fields within records in an ODBC compliant database to individual cells within a Visio ShapeSheet of a master or an instance of a master. These connections can be made to many different ShapeSheet cells including:Shape DataShape textData1, Data2, and Data3 User-defined cellsAny named Visio ShapeSheet cell Note: At least one “connection” must be made between a field in a record and a Visio Shape Data row to construct a valid database linkage.The Link to ODBC Database Add-onTo perform the actual linkage between the data source and a given master or instance of a master in Visio, you use the Link to Database Add-on.You can attach the data source to:A master shape on a stencil opened in edit mode.A master shape in a Visio drawing’s document stencil.An instance of any master on a Visio drawing page.A shape on a page with no connection to a master.Try it! Link to DatabaseOpen <install folder>\Demos\Vol2\Linking Visio Drawings to a Database\Link to Database.vsd.Select the shape you would like to create the link within.You have the choice of creating a database link to either the Personal computer shape on the page, or that shape’s master on the document stencil. To select the master in the Document stencil, first right-click the master shape, choose Edit Master > Edit Master Shape, and then select the master shape.From the View tab, choose Add-ons > Visio Extras > Link to ODBC Database…On the Link to Database dialog, from the ODBC data source Name list, choose Visio Database Samples.You do have the ability to create a new data source at this point (Create button). We will be covering those steps in the next demonstration.From the Table/view list, select Network – Computers.The Field links list is populated with the fields present in that table. Note: At this point, you can also create a new table in the already established database, modify the details of a field, or delete a field by utilizing their respective dialog buttons.Click the Advanced button.From the Advanced dialog, under Shape drop event, click the Select record radio button, and click OK.Click the OK button on the Link to Database dialog to complete the linkage process.Open the ShapeSheet to view the Shape Data section. Note: When a shape is linked to a database, the Link to ODBC Database Add-on inserts the Shape Data section, and appropriate cell values, and a User-defined section into the ShapeSheet if they are not already present (or adds rows to them if they are). The User-defined section is where the Wizard stores information about the primary key for the database, the database fields that are linked to the ShapeSheet cells, and the last valid data retrieved from the database.Insert text fields for each property value to be displayed. For example, to add a field after the text “Owner” and link it to the custom property Owner, click in the text in the space following “Owner:” Choose Insert > Field… from the menu. In the Field dialog choose Category > Shape Data. This will display the shape data fields of the shape in the field area. Choose Field > Owner.This will display as text on the shape the shape data fields to the user once the shape data values have been filled in from the database. If you chose to link the master on the document stencil, drag a new instance of it onto the page and select a new record for that shape. If you chose to link the shape on the page, make a copy of it on the page and complete the same action.Database Actions and ActivitiesOnce the Link to ODBC Database Add-on has run, the user will find several items added to the shape’s right-click menu. These Action items allow the user to perform the following functions:When the Shape is dropped from a stencil, the user can be automatically prompted to select a database record to associate with the instance.When the database is changed, a user can refresh the shape’s property values with current data.When the Shape Data value is changed in the Visio SmartShape?, the database can be updated to reflect the change or a new database record can be created based on the new Key value.When the shape is deleted, the database record can be deleted as well. Note: Be careful not to delete database records from the Link to Database demonstration’s linked table using the right click menu item. It is a Visio installed sample table.The Export to Database Add-onThe Visio Export to Database Add-on functionality is an excellent way to take data that you have defined in shapes on a drawing page and export that data to a table in a database, such as with a network diagram. Note: When you export shape data from your drawing page to an existing table, Visio takes all the data from that table and replaces it with fields and data from you existing drawing.Try it! Export to DatabaseOpen <install folder>\Demos\Vol2\Linking Visio Drawings to a Database\Export to Database.vsd. From the View tab, choose Add-ons > Visio Extras > Export to Database. If you can see an ODBC Data Source error, choose Close and go on to the next step.Click the Create… button.On the 1st Wizard screen, choose User Data SourceOn the 2nd Wizard screen, choose Microsoft Access Driver (*.mdb)On the ODBC setup dialog, name your data source and click the select button.On the Select Database dialog, navigate to the local directory you copied Export Database.mdb, select it, and click OK.Back in the ODBC setup dialog, click the OK button.In the Export to Database dialog, make sure the cells you want to export are in the list. If they are not, click the Add button, and make your selections. You can also Modify and Delete cells from the export list. When all the cells you would like to export data from are in the Cells to export list, click OK.The RMA to update the table in this case is accessible at the page level, providing an update for all shapes on the page.Lab 2.1 Export Shape Data to DatabasePoints to ConsiderBasic Network.vst is a native Visio template.To create the new data source, the database table will need to reside locally on your hard drive.You can use the existing table in the database, or create a new one in the Export to Database dialog.Summary: Linking Visio Drawings to a DatabaseVisio shapes can be linked to external data sources using the Database Wizard and the linked data is stored in the shape’s ShapeSheet. Within Visio this information is retained within the shape and stored with the drawing. Shape Data can be modified from within Visio and can be displayed using Text Fields or through the Shape Data Window. Database tables can also be updated from Visio through the linkages created by the Database Wizard.Shape Data can be exported to a database, creating a new table, using the Export to Database Add-anization Chart SolutionOverviewMicrosoft Office Visio is commonly used to develop organization charts for business that range from a small number of employees to very large organizations numbering in the thousands. There are different approaches that can be taken to build an organization chart with Visio, from using the Visio user interface drag and drop tools to create your drawing to using automation wizards that read organization information from a file or database and create the organization charts automatically.The wizard can be run interactively from the Visio user interface or it can be launched programmatically. Running the wizard programmatically is often referred to as “silent” mode because it can be set to run without any user interaction. All of the information that is normally provided to the wizard interactively when launched from the UI can be provided as parameters when the wizard is launched in “silent” mode. Creating organization charts in VisioThe drag-and-drop construction techniques of Visio, coupled with Visio’s SmartShape technology make the creation of organization charts very easy.The following demonstration illustrates the key points of constructing an organization chart drawing.Try it! The Basics of creating an organization chart in VisioStart a new drawing that is based on the organization chart template. From the menu, choose File > New > Business > Organization Chart (US Units). Alternatively, you could choose Organization Chart (Metric) or your own custom template. From Organization Chart Shapes, drag the Executive shape onto the drawing page. Add a name and title to the shape. Select the shape, and then type the name of the person holding the position that shape represents. Press ENTER, and then type the person's title. Click anywhere outside the shape. From Organization Chart Shapes, drag a Manager shape directly onto the Executive shape to establish a reporting relationship. Add a name and title to the shape. Repeat until you've added all the managers you want. From Organization Chart Shapes, drag a Position shape directly onto a Manager shape to establish a reporting relationship. Repeat until you've added all the positions you want. Notice that by dragging and dropping a Manager shape onto an Executive shape or a Position shape onto a Manager shape, Visio automatically constructs a properly connected reporting relationship. There is no need for the user to add connections between the shapes. This makes basic drawing construction very quick and easy.We will next explore various options for organizing and fine-tuning the organization anization Chart MenuLet’s explore some of the options available for managing the organization chart drawing. These can all be found under the menu Organization Chart. Many can also be found by right clicking a shape or from the Organization Chart Toolbar.Re-layout. The shapes in your organization chart are automatically arranged in the best way possible, while maintaining your layout preferences defined under Organization Chart – Change Spacing. Note: The Organization Charts use their own specialized layout algorithms that are separate from the general layout tools available in Visio.Best Fit to Page. Visio will adjust the spacing and choose the layout to fit the maximum number of shapes to a page.Arrange Subordinates. Select the shape whose subordinates are to be arranged. There are choices for horizontal, vertical, and side-by-side layouts. Only the immediate subordinate shapes are affected.Hide Subordinates. The function makes all shapes on the page that are subordinate to the chosen shape invisible. Show Subordinates makes them visible again.Move Subordinates. Moves a shape (and its subordinates) left or right in a horizontal display and up or down in a vertical display. It does not change the reporting structure. Note: If you wish to change who a position reports to, drag the corresponding shape and drop it on the person to whom they are to report. The connections are redrawn automatically.Change Position Type. Any of the shapes Executive, Manager, Position, Consultant, Vacancy, Assistant, or Staff can be changed to one of the other types. It is not necessary to delete and replace one of these shapes in order to change its type.Synchronize. There are two items in the Synchronize group: Create Synchronized Copy… and Expand Subordinates.Create Synchronized Copy… It is often helpful to be able to repeat a portion of an organization chart on different pages within the drawing. Create Synchronized Copy makes this very easy. Create the portion of the organization chart that you wish to duplicate in one portion of the drawing. Choose Create Synchronized Copy… to copy a shape and all of its subordinates to another section of the drawing. If changes need to be made, they can be made in either place and the changes will be “synchronized” to the other location. See the help file for “Create Synchronized Copy” for specific limitations of this function.Expand Subordinates. Some changes to a Synchronized drawing such as the addition of a new subordinate shape or the deletion of a subordinate shape will not show up automatically in all synchronized views. Use the Expand Subordinates feature to force the update to be made. Note: Expanding subordinates applies to one level of subordinates for a shape. If you added more than one level of subordinate positions to a synchronized copy, when you update the other synchronized copy you must expand each level. Note: In the upcoming lab, we will explore these features as part of the anization Chart Menu (cont.)Let’s explore the remaining options available for managing the organization chart drawing. Import Organization Data. Run the Organization Chart Wizard.Export Organization Data. Organization chart data can be exported to a file. Every shape data field that is part of the organization chart will be exported as part of the data. You can export organization chart data in Microsoft Office Excel workbook (.xls), text tab-delimited (.txt), and CSV comma-delimited (.csv) formats. Compare Organization Data. Use to compare two versions of an organization chart. The comparison includes custom property data in each drawing.Change Spacing… Change Spacing allows the user to set the minimum spacing between shapes value for auto layout.Display Options… A three tabbed dialog box with the following tabs:Options. Control shape dimensions, organization chart display themes, pictures, etc.Fields. Control which custom properties are displayed in the shape as text fields.Text. Apply fonts and text formatting at the field anization Chart ReportingAfter you've added data to organization chart shapes, such as names, titles, and telephone numbers, you can create a report of that data and save it to a file that you can print or distribute to others. Microsoft Office Visio provides a ready-made report that includes the default shape data fields that are stored for each organization chart shape.If additional shape data fields are added to the shapes in the drawing, the report can be modified to also report on these new properties.To run organization chart reportChoose Review > Shape Reports.In the Reports dialog, under Report, click Organization Chart Report.Click Run. Note: If you do not see the Organization Chart Report or another report that you wish to run, clear the Show only drawing-specific reports check box, or click browse and navigate to the location of the report definition.Lab 2.2: Exploring the organization chart user interfaceWe’ve provided a description of the function that each of the Organization Chart menu items provides. Now let’s explore some of these features.Lab: Exploring the Organization Chart solution user interfaceOpen <install folder>\Demos\Vol2\Organization Chart Solution\ Sample Organization Chart.vsdWork with the following features to become familiar with how each operates. Rearrange the organization chart to make it more to your liking.Arrange SubordinatesChange the subordinates of some of the shapes to use vertical, horizontal, or side-by-side layoutExperiment with putting the layout lines on the left or rightHide/Show Subordinates - hide or show the subordinates for a shapeMove Subordinates – move a shape left/right in a horizontal layout or up/down in a vertical layoutBest Fit – will re-optimize the layout for the page Create Synchronized CopyFind the shape for Ashley Larsen (Use the Edit – Find command)Create a synchronized copy of Ashley’s organization on a new page in the drawing. Right click the shape for Ashley Larsen and select Create Synchronized Copy.Choose New page and OKThis creates a copy of Ashley’s organization onto a new page in the drawing. Right click on the original Ashley Larsen shape and select Hide Subordinates.Go to the new page where the copy was made and make changes to Ashley’s organization. Add a shape, delete a shape, change some text, etc.Go back to the original Ashley Larsen shape. Right click and select Show Subordinate. Note that text changes are synchronized, but adding and deleting shapes are not.Go back to the original Ashley Larsen shape. Right click and select Expand Subordinates. Note that added shapes are synchronized, but deleted shapes are not. Note: This command works only one level down. You may have to select your way down the organization chart and select Expand Subordinates depending upon where your changes occurred.Export the organization data to an Excel spreadsheet. This data can be used later as we learn about the Organization Chart anization Chart WizardThe Organization Chart Wizard will create an organization chart from data that is stored outside of Visio. This data can be stored in a text (.txt) file, as an Excel spreadsheet (.xls), or an ODBC compliant data base. The data can also be extracted from Microsoft Exchange Server. Try it! The Organization Chart WizardRun the wizard in any of these ways:View > Add-ons > Business > Organization Chart WizardOrg Chart > Import File > New > Business > Organization Chart WizardOn the first screen click “Information that’s already stored in a file or database.”Choose “A text, Org Plus(*.txt) or Excel file” Click Browse to “Locate the file that contains your organization information”Open <install folder>\Demos\Vol2\Organization Chart Solution\ ORGDATA.XLSOn the next screen choose the data fields that uniquely define the records in the organization data.On the next screen select the data to be displayed as text fields in the organization chart.On the next screen select the data fields that are to be included in the drawing shapes as custom properties.Choose “I want the wizard to automatically break my organization chart across pages.” We’ll explore the other options later.Data file structureIn order to build an organization chart from your personnel data, the Organization Chart Wizard must be able to identify:Each person uniquely. This could be by employee name, but only if there are no duplicate names in the data file.Employee’s name. The way the name appears in the data file is how it will appear in the organization chart.A reporting hierarchy. Each person must be designated to report to someone else that is in the data file, except the top level employee, who reports to no one.In the following file, the Name field uniquely identifies every employee and the Reports_To field refers to the Name field.In the following file, the Name field is not unique. There are two employees with the name Robert Williams. To uniquely identify each employee an Employee_ID field has been added and the Reports_To field refers to the Employee_ID field.Note that in both cases the Reports_To field is blank for the person at the top of the organization structure.Tips on using the Organization Chart WizardIf the wizard cannot generate an organization chart because of errors in the data file check for these common mistakes. IssueIf the wizard stops because of errors in the data file, check for:Duplicate employee names or ID numbersInvalid Reports To informationFailure to leave blank the Reports To field for the person at the top of the organization.IssueYou wish to control the information displayed on the shapes using data imported by the wizard.The wizard will prompt you for the data that you wish to display. Information displayed as shape text can come from any field(s) in the data. The wizard displays a screen that says “Choose the columns (fields) from your data file that you want to display.” Select each of the fields that you wish to display as text on the shape. Note: If the text will not fit, the shapes may need to be resized. To resize the shapes choose Organization Chart > Options > Options tab. Set the shape width and height. This affects all shapes in the drawing.IssueThe organization chart is too big for one page.The wizard allows you to control how much information is displayed on each page. By default, you can let the wizard make all of the decisions and then make any desired changes to the drawing after it has been created.Alternatively, to control how the organization is broken across pages, choose the option “I want to specify how much of my organization to display on each page.”The wizard presents a screen that allows each page to be specified. You control who is at the top of the page, how many levels to display (or choose all subordinates), and the name of the page. Tip:To reduce clutter on a page that has too much information select a shape with subordinates that you would like to place onto a new page and choose Create Synchronized Copy. Select the same original shape again and choose Hide Subordinates. Adjust the layout of the remaining shapes on the page or let Visio do it for you with Re-layout.IssueAfter the organization chart is created you want to view data associated with each chart shape.Use the Shape Data window to view the data. You can also create additional text fields on the shapes to display more data.Running the organization chart solution in “silent” modeThe organization chart wizard can also be run from the command line or it can be started from a program or macro.From the command line:General syntaxOrgWiz.exe <argument list>Example"C:\Program Files\Microsoft Office\Visio11\DLL\ORGWIZ.EXE" "/USE-LAST-VALUES"The following code is an example of a macro that will launch the wizard. It can be executed from VBA. There is a demonstration file called WizardMacro.vsd included in the student materials which contains this code.Sub WizardMacro() Dim oAddon As Visio.Addon 'Get a reference to the addon for the Organization Chart Wizard Set oAddon = Visio.Addons("OrgWiz.exe") 'Run the addon and pass as a string the parameters to control the wizard oAddon.Run ("/USE-LAST-VALUES")End SubCommand arguments for organization charts ArgumentPurpose/USE-LAST-VALUESReads values from the registry chosen by the last person who used the Organization Chart Wizard. If this argument is specified, all subsequent arguments are ignored. /FILENAME=<filename>Required, unless /DATASOURCE or /MICROSOFT-EXCHANGE is specified. Specifies the data file name you want the wizard to read. If the file name includes spaces, put the name in quotation marks. /DATASOURCE=<datasourcename>, TABLE=<tablename>, DBQUALIFIER=<databasequalifier>Required, unless /FILENAME or /MICROSOFT-EXCHANGE is specified. Specifies the name, table, and qualifier of the ODBC-compliant database you want the wizard to read/MICROSOFT-EXCHANGERequired, unless /FILENAME or /DATASOURCE is specified. Specifies that you want the wizard to read the Microsoft Exchange Server data. /NAME-FIELD=<fieldname>Optional. Specifies the field in the data file where the wizard can find employee names. If you don't specifiy this field, the wizard will look for common names, such as Name, Employee, Employee Name, or Employees. If it doesn't find a likely field, the wizard will fail. /MANAGER-FIELD=<fieldname>Optional. Specifies the field in the data file where the wizard can find Report-To information. If you don't specify this field, the wizard will look for common names, such as Manager, Reports To, or Reports-To. If it doesn't find a likely field, the wizard will fail. /FIRSTNAME-FIELD=<fieldname>Optional. Specifies a field in the data file where the wizard can find employees' first names. If you don't specify this field, the wizard will look for common names, such as First Name or First-Name. If it doesn't find a likely field, the wizard will continue building the organization chart. /UNIQUEID-FIELDOptional. Specifies the field containing the unique identifier. If this argument is not specified, the wizard will look for a field containing the same data values that are in the MANAGER-FIELD field. If it doesn't find a likely field, the wizard will fail. /SHAPE-FIELD=<fieldname>Optional. Specifies a field in the data file where the wizard can find the name of the organization chart master in Microsoft Office Visio that you want it to use. If you don't specify this field the wizard will look for common names, such as Master Shape or Master-Shape. If it doesn't find a likely field, the wizard will continue building the organization chart using shapes it chooses based on the reporting structure. For example, you can put Executive in the Shape field for the person at the top of the organization chart to indicate that the wizard should use the Executive shape for this person when it builds the organization chart. /HYPERLINK-FIELD=<fieldname>Optional. Specifies a field in the data file where the wizard can find the text used for a shape's hyperlink. The wizard will search the data file for a column named HYPERLINK or URL. If it doesn't find a likely field, the wizard will continue building the organization chart. The wizard will read the contents of the column and store that text in the shapes as hyperlink addresses. The hyperlink destination is accessible by right-clicking the shape and then clicking a hyperlink. /PAGES=<top employee> <num levels> PAGENAME=<pagename>, <top employee> <num levels> PAGENAME=<pagename>...Optional. Specifies how you want the wizard to break the organization chart into pages. If you specify this argument, you must identify the top employee on each page (required). Optionally, you can include the number of reporting levels to include on a page, and the page name. If you don't specify the number of levels, the wizard includes all levels on a page. Names with spaces must be in quotation marks. Always include a space between <top employee> and <num levels> and PAGENAME=<pagename>. If you don't specify the pages, the wizard defines the pages, and places an appropriate number of shapes on each page. /DISPLAY-FIELDS=<fieldname>, <fieldname>, ...Optional. Specifies the fields from the data file that you want to display in each box in the organization chart. If you don't specify fields, the wizard displays the employee name. The order of this list is the order displayed on the shapes. /CUSTOM-PROPERTY-FIELDS=<fieldname> HIDDEN, <fieldname> HIDDEN, ...Optional. Specifies the fields from the data file that you want to add to the organization chart shapes as custom property fields. Optionally, insert the HIDDEN modifier after custom properties you want to be invisible to the user. For example, your data file might include fields for department name, telephone number, and office number. By adding these fields as custom property fields on the organization chart shapes, you allow users of the organization chart to access the data in these fields by right-clicking the shapes representing employees. Also, you can use the HIDDEN modifier to store information about the source data in your shapes, without displaying it in the Custom Properties Window. For example, if you want to create an organization chart that shows the hierarchy of tasks from Microsoft Project, you can store the Project Task ID value as a hidden custom property. /SHOW-DIVIDER-LINEOptional. Specifies a divider line on organization chart shapes that separates the first line of display text (such as employee name) from the second (such as title). /SYNC-ACROSS-PAGESOptional. Specifies that all shapes representing the same employee that appear on different pages of the drawing will be synchronized, so that changes made to one of the shape's text or custom properties will be made to all the shapes. /HYPERLINK-ACROSS-PAGESOptional. Specifies that all shapes representing the same employee that appear on different pages of the drawing will contain hyperlinks to each other. The hyperlink destination is accessible by right-clicking the shape and then clicking the hyperlink. /LAUNCHGUIOptional. Specifies that the drawing-definition organization chart wizard pages will be displayed to the user, so that the user can interactively modify the command-line arguments. The user will not be able to change the data source specified in /FILENAME, /DATASOURCE, or /MICROSOFT-EXCHANGE. Lab 2.3: Running the wizard in “silent” modeCreate a VBA macro that launches the organization chart wizard.Lab: Run the Organization Chart Wizard from a macroOpen <install folder>\Labs\Vol2\Start\WizardMacro.vsdModify the macro that launches the wizard to control the following parameters:Open the sample file <install folder>\Demos\Vol2\Organization Chart Solution\ORGDATA Sample1.xlsDisplay the Name and Title fields as text on the shapeTurn on the divider line between the Name and Title fieldsLaunch the interactive interface of the wizard so that additional options may be selectedSummary: Visio Organization Chart SolutionWe have now seen that there are several important features in the Visio Organization Chart solution that aid in the efficient construction of organization charts. Pivot DiagramsA PivotDiagram is a collection of shapes arranged in a tree structure that helps you to analyze and summarize data in a visual, easy-to-understand format. In this lesson you will learn:How to create pivot diagrams in VisioHow to traverse the pivot structure and view the data by different categoriesExpand or collapse individual nodes within the diagramRefresh the data connection and update the diagramFilter the data to exclude extraneous data or to focus the resulting diagram on a specific area of interestWork with the Pivot Diagram window and commandsConceptual OverviewAbout PivotDiagrams and data sourcesIn Visio, the entry point into a pivot diagram is a single shape, called a top node, that contains information imported from a worksheet, table, view, or cube using the Data Selector dialog. You can break the top node into a level of subnodes to view your data in various ways.Categories, levels, and nodesTo understand categories, levels, and nodes, think of each element in the context of your data source:Each column of your data source is either nonnumeric or numeric. Think of the nonnumeric columns as categories?— like Quarter, Salesperson, or Phone Number. Any of these can become a level under the top node. Note that the values under a column like Phone Number might be numbers, but they are not numbers that can be totaled or otherwise summarized. Think of the numeric columns as data such as numbers or currency that can be summed or averaged, or that have minimum or maximum values. Think of each node as a group of rows from your data source that have a common value in a specified column. For example, for the category "Quarter," all the rows with QTR4 would be grouped into a single node. Parts of a PivotDiagram?Name of the PivotDiagram?Top node of the PivotDiagram?Breakdown shape?Data legend?The Qtr3 and Qtr4 shapes together are a level?Node with a shape applied to add impactSample scenarioLet's say you have an Excel worksheet with information about sporting goods sales for the last two quarters like the one shown below.What you need to know is:How much did each sports department make? How much was earned in each quarter? How much profit did each salesperson make? A PivotDiagram can show your data arranged in three different tree views to answer those three questions.The following figure shows three ways to view your source data to answer your specific questions.Try it! Pivot DiagramScenario:We have a table of data containing team hitting data for all major league baseball teams for the year 2006.Here are some questions we would like to find answers to:Which team had the highest team batting average in baseball in 2006?Was the AL or NL the best hitting league that year?Who were the top 5 run producing teams overall?Is there a correlation between the top home run hitting teams and the teams with the highest number of runs scored? In other words, does hitting more home runs generally produce more runs? After all, it is runs scored that win games, not the number of home runs hit!We will use Visio’s pivot diagrams to analyze the data and find answers to these questions.View the dataOpen MBL Batting Data 2006.xls. It is in the class file folder called Samples.Note that there is one row of data for each team. There are various statistics for each team, such as the number of doubles hit, home runs hit, team average, slugging percentage, etc.There is also a column designating the league that the team is a part of.Note that the name of the worksheet in the data file is Team Hitting.The figure below shows a portion of the data.Create the pivot diagram in VisioStart Visio. Create a new pivot diagram from the template File > New > Business > Pivot Diagram. This creates a new drawing and starts the Data Selector wizard.Because our data is in Excel format, choose Microsoft Office Excel workbook on the first page of the wizard.On the next page of the wizard browse to the location of the Excel data file. Choose Next.On the next page of the wizard specify the worksheet or range that you want to use. This is ‘Team Hitting$’ which is derived from the name of the worksheet in our data file.The first row of our data contains header names for each column of data. Make sure the check box on this page of the window is checked. Choose Next.On the next page you can filter the data if desired. Choose Select Columns. To filter the data, uncheck any columns that are not needed. Uncheck the column named ID. For this demo we will accept all of the data. Choose OK.Choose Next and Finish.The pivot diagram shown below is created.The three elements displayed include the name of the pivot diagram, the top level pivot node, and the data legend.In the top level pivot node, note that Games is the default field displayed. The value 4858 is the total number of games played by all of the teams in our data file. Visio chooses the first numeric column it finds (a column that it can total) to be the default column displayed. We’ll change this in a moment.Pivot diagram basicsCheck that the Pivot Diagram window is showing. If it is not select Pivot Diagram > Show/Hide > Window.Select the top level pivot node. In the Pivot Diagram window under the Add Category choose League. This causes the selected node to have its data broken down by League.The diagram now appears as follows. Note that a Breakdown shape has been added labeled League. Also, another level of breakdown shapes have been added that breaks the data down for all AL and NL teams.The number of games for each league is different. Since all teams in baseball play the same number of games, this must mean there are a different number of teams in each league. In the Pivot Diagram window under Add Total, scroll down and mark the check box for Count. The Count field was automatically added to the Pivot data. It contains the number of records that make up each node. Since there is one record per team within this data set, the value of Count tells us how many teams are in each league.Which team had the highest team batting average in baseball in 2006?Now let’s start analyzing the data and find answers to the questions posed at the beginning of this demonstration.Right click the top level node and choose Add Category > Average. This is equivalent to choosing Average from Add Category in the Pivot Diagram window. This displays some nodes with the value for Average at the top of the node, but it doesn’t display a node for all 30 teams! Where is my data?Right-click the breakdown shape called Average and choose Sort. The Breakdown Options dialog is displayed. Since we want to find the team with the highest average choose Descending. Under Show note the checkbox “Limit items in this breakdown”. The default is for this to be checked and to have a value of 10. This is why we didn’t see a node for each team earlier. Since we only want to find the team with the highest average, we don’t need to see the data for all of the teams. Set the limit to a small value, say 3. This will tell us the top three teams and also allow us to check that the sorting direction is set correctly.The top three teams hit .287, .285, and .284 respectively. But what is the name of the team?Multi select the three nodes, right-click and choose Team. You can break down multiple shapes at one time! Now we have our top three teams: Minnesota Twins, New York Yankees, and Toronto Blue Jays.Was the AL or NL the best hitting league that year?To answer this question we need to accumulate the team batting averages by league. Before we start, go to the Pivot Diagram window and under Add Total check Average(Sum).Note that Average is now displayed within each node. At the team node level the value represents the value for one team as shown below.However, at the top level node the average is the sum of the averages of all of the nodes beneath it. For an average, this not very helpful, but we’ll see how to fix this in a moment.Right-click the top level node and choose League.What does this tell us? Unfortunately, not much! If the number of teams in each league were the same we could say that the NL has a higher average, but we still don’t know what that average is. The number we really want to see is the average of the averages. Mathematically this may not be the best calculation, but for our purposes will be very close and from this we will be able to answer our questions.Look through the Pivot Diagram window and browse the Add Total section. Find Average(Sum), hover over it with the mouse and note that there is a drop down associated with it. From the drop down choose Avg. This adds to our pivot diagram the average of the averages as seen below.Now we can answer the question as to which was the better hitting league. The AL had the higher team average at 0.274 as compared to the NL average of 0.264.Display the batting average as a data barLet’s use the Data Graphics features of Visio to display the batting average as a data bar.If the Data Graphics window is not displayed, choose Data > Display Data on Shapes to turn it on.Within the Data Graphics window is displayed all of the data graphics that are part of the currently active drawing. We will modify the one being used on this page. If you can’t tell which is being used then right-click a Data Graphic in the Data Graphics window and choose Select Shapes that use this Graphic. This selects the shapes in the pivot diagram that have this graphic assigned to them.Once the correct data graphic has been found, right-click the data graphic and choose Edit Data Graphic. The Edit Data Graphic dialog is displayed.Choose New Item and Data Bar. The New Data Bar dialog is displayed. We will use this item to display our calculated average.Set Maximum Value to 1, since the value for average should be a number between 0 and 1.Set Label to Batting Average.Click in the Value Format and then click on the ... button. This displays the Data Format dialog. Set the category to Number and set the number of decimal places to 3.Under Data Fields choose Average(Avg). Choose OK to close the Edit Data Bar dialog. In the Edit Data Graphic dialog select the data graphic that is displaying Text for the data Average(Avg). Choose Delete. Choose OK again to close the Edit Data Graphic dialog.If all is successful, the diagram should update with the modified data graphic as follows.Who were the top 5 run producing teams in baseball?After what we’ve learned so far, you should have a pretty good idea about how to answer this.Right-click the top level node and choose Team.In the Pivot Diagram window under Add Total, uncheck Games, Average, and Count. Note that the calculation for Batting Average also disappears since it is dependent upon the values Average.Check Runs(Sum). The only field shown in the Data Graphic now is Runs.Right-click the Team breakdown shape and choose Sort. Choose the Sort by field to be Runs(Sum), choose Descending, and set the number of nodes to display to 5.The top run producing teams are: New York Yankees(930), Cleveland Indians(870), Chicago White Sox(868), Philadelphia Phillies(865), and Atlanta Braves(849).Is there a correlation between the top home run hitting teams and the teams with the highest number of runs scored? In other words, does hitting more home runs generally produce more runs? After all, it is runs scored that win games, not the number of home runs hit!To answer this question we will find the top five Home Run teams in all of baseball and compare those five teams against the five found earlier to see how many are in common.We could just make a different pivot on the data we already have, but the comparison would be easier if we can display the two results side-by-side.Within the same drawing choose Insert > Pivot Diagram and insert the data from the same data file. Visio creates a new top level pivot node and automatically places it in some empty space on the drawing page. Note that the pivot label is 'Team Hitting$'-2 or something similar.If it is not there already, move the new pivot node to the right hand side of the drawing. This will help with the final layout later.The new pivot node will have its own default data graphic and the fields selected by using Add Totals in the Pivot Diagram window are independent of the fields chosen for the first instance of this data.Make sure that the newly inserted Pivot node is selected. In the Pivot Diagram window, under Add Totals, turn off any checked boxes and turn on HR(Sum). The only field shown in the data graphic should now be HR.Right-click the top level node and choose Team.Right-click the Team breakdown shape and choose Sort. Sort by Runs(Sum) and select Descending and limit the display to 5 nodes.We now have the top five home run hitting teams identified. They are: Chicago White Sox(236), Atlanta Braves(222), Cincinnati Reds(217), Philadelphia Phillies(216), and New York Yankees(210).Now we have all of the data. Let’s use the layout tools to put the data visually side-by-side.Select the top level node for 'Team Hitting$'. Choose PivotDiagram > Layout Direction > Left-to-Right.Select the top level node for 'Team Hitting$'-2. Choose PivotDiagram > Layout Direction > Right-to-Left.In this view it is now easier to see that 4 of the 5 top run producing teams are also in the top five in hitting home runs.Displaying a calculated field in the pivot diagram Sometimes you may want to display a calculated field as part of the data in the pivot diagram. This can be done with Data Graphics!Let’s display a bar chart showing how a team’s hits break down between singles, doubles, triples, and home runs. A close look at the data reveals that the number of singles is not included as a separate item in the data, but it can be derived by subtracting the number of doubles, triples, and home runs from the total hits.Collapse the pivot diagram to a single node.In the Pivot Diagram window, under Add Total, turn on Hits and turn off any other displayed data.In the data graphics window select the data graphic being used for this pivot diagram and choose Edit Data Graphic.From the Edit Data Graphic dialog, select New Item and then choose Data Bar from the drop down list.From the New Data Bar dialog set Callout to Multi-bar graph.From the New Data Bar dialog in Data field, scroll to the bottom and choose More fields. The Field dialog is displayed. Select Custom Formula and then enter the following as the custom formula:={Hits}-{2B}-{3B}-{HR}Choose OK to close the dialog.From the New Data Bar dialog set the following values:Max=1200Value Position=Interior-RotatedLabel Position=BottomLabel 1=SField 2=2BLabel 2=2BField 3=3BLabel 3=3BField 4=HRLabel 4=HRChoose OK to close the dialog.A portion of the pivot diagram is shown below. The data displayed in the first bar labeled “S” for single is the calculated value.Exploring Drill-downCreate a PivotDiagramTo create a PivotDiagram, you can use the PivotDiagram template, or you can insert a Pivot Node shape into any Microsoft Office Visio Professional 2007 diagram. When you create a PivotDiagram, the Data Selector Wizard guides you to point to a data source. The data is then imported into a top PivotDiagram node, which is displayed in your drawing. You then expand the top node to show the data that you want to analyze. Note: It is a good idea to make sure that the top cell in each column in your Excel worksheet is a column heading rather than a row of data. Headings aren't required, but they make the completed PivotDiagram much easier to understand.Try it!Choose File > New > Business > PivotDiagram. Follow the steps in the Data Selector Wizard. Choose Microsoft Office Excel Workbook. On the next screen, choose Browse and traverse to …/Samples/Sales data.xlsChoose Finish.After you click Finish, the following three shapes appear on the drawing page: A data legend containing information about the data source A text box for the name of the PivotDiagram The top node, which contains the imported data set Click the top node on the drawing page, and in the PivotDiagram window, under Add Category, click the category (usually a column in your data source) by which you want to group your data. Note: You may need to maximize the PivotDiagram window to see all of the features.To further expand the new subnodes to expose other levels, click the node that you want to expand and repeat step 3.Refresh the data in a PivotDiagramYou can refresh the data in an existing PivotDiagram. If your drawing contains more than one PivotDiagram, you can refresh one or all of them.To refresh all of the PivotDiagrams in a drawing, in the PivotDiagram window, under Actions, click Other Actions, and then click Refresh All. To refresh only one PivotDiagram, select it in the drawing. In the PivotDiagram window, under Actions, click Refresh Data. Try it!Open the file Sales data.xls. This is the file containing the data used to create the pivot diagram.Modify the data by adding additional records or changing some values.In Visio, refresh the data and note the updates in the Pivot Diagram.Filter the data in a PivotDiagramEach node in a level of a PivotDiagram represents a group of rows in your data source that share a common value. For example, a node for the fourth quarter (Qtr4) would contain all of the numeric data for the rows that have Qtr4 in the Quarter column.You can use filters to choose which nodes appear in a given level. For example, if the data for the third quarter is no longer of interest, you can conceal the Qtr3 node:Try it!In the PivotDiagram window, under Add Category, right-click the data that you want to filter, and then click Configure Column. In the Configure Column dialog box, under Filter, under Show data where category name, select the operations in the leftmost column (choose equals), and type the values into the rightmost column (Qtr4) to specify the data that you want to work with. After closing the dialog, only Qtr4 data is presented in the drawing since this is the only data that meets the criteria chosen. Note: Any filters that have been created are displayed in the data legend shape.To remove the filter, reset the operations in the leftmost column of the Show data where list to (Select Operation). Note: If your data source is a SQL Server Analysis Services cube, right-click the item that you want to filter, click Configure Dimension, and in the Configure Dimension dialog box, click Configure Level. In the Configure Level dialog box, under Filter, under Show data where category name, select the operations in the leftmost column, and type the values into the rightmost column to specify the data that you want to work with.Customize the data in PivotDiagram nodesWhen you expand a PivotDiagram node, a default set of data is displayed in each node. You can change which numeric data is displayed, the name of that data, and how numeric data is summarized. Show or hide specific dataWhen you show or hide the numeric data (usually a column in your data source), the change is applied to all of the nodes in the selected PivotDiagram. Try it!Select any node of the PivotDiagram. In the PivotDiagram window, under Add Total, select or clear the check boxes for the data that you want to show or hide. In the PivotDiagram window, under Add Total, right-click Sales and choose Avg. Average sales is now displayed on the pivot nodes. Note that this column can also be configured. Change the configuration so that only sales greater than $600 are displayed.Change how numeric data is summarizedThe default data shown in a PivotDiagram node is the sum of the first column from your data source. You can change the summary function? from Sum to Average, Min, Max, or Count. Note: This does not apply to SQL Server Analysis Services.Try it!In the PivotDiagram window, under Add Total, right-click Sales and choose Avg. Average sales is now displayed on the pivot nodes. Note that this column can also be configured. Change the configuration so that only sales greater than $600 are displayed.Change the names of items in the Add Category and Add Totals listsTry it!In the PivotDiagram window, under Add Category or Add Total, right-click the item that you want to change, and then click Configure Column. In the Name box of the Configure Column dialog box, type a new name. Change Salesperson to Sales Associate.To revert to the original name, click Use Source Name.Limit the number of nodes in levelsYou can choose how many nodes to display in a single level or in all levels of your PivotDiagram. This is helpful if you are working with large worksheets, tables, or views and you don't need to see all of the data broken into separate nodes.For example, you may want to show only the first 5 nodes in a level of salespeople or the first 20 nodes in a level of orders.Try it!Create a new pivot diagram.Import the data from the Northwind database in the Samples directory.When prompted for “What table do you want to import?”, choose Product Sales for 1997.Drill into the pivot diagram to display some data. For example, on the first level display CategoryName and on the second level display ShippedQuarter.Limit the number of nodes displayed in all levelsTry it!Click the top node of the PivotDiagram that you want to change. On the PivotDiagram menu, click Options. In the PivotDiagram Options dialog box, under Data options, select the Limit items in each breakdown check box. In the Maximum number of items box, type the maximum number of nodes that you want to show. For each level, a new node with an ellipsis (...) in its title bar appears in your PivotDiagram. These shapes contain the hidden nodes for each level.Limit the number of nodes displayed in a single level Note: The Visio Help file says this works for a single level, but experimentation shows that changing the number of nodes displayed is not limited to a single level, but instead is applied to all levels below the selected shape. Note: Selecting a Breakdown shape or selecting the pivot node just above it and then changing the number of nodes to be displayed are equivalent.Try it!In your diagram, select the Breakdown shape of the level that you want to limit. On the PivotDiagram menu, click Sort. In the Breakdown Options dialog box, under Show, select the Limit items in this breakdown check box. In the number box, type the maximum number of nodes that you want to show. Note: The number of nodes displayed cannot be less than 2.A new node with an ellipsis (...) in its title bar appears in your PivotDiagram. This shape contains the hidden data for that level.PivotDiagram windowThe PivotDiagram window appears when you create a PivotDiagram or when you insert a PivotDiagram into any Microsoft Office Visio Professional 2007 drawing.Add CategoryThe Add Category list shows categories in your data source by which you can group your data. The categories correspond to columns for most data sources (dimensions for Microsoft SQL Server Analysis Services). To break a node down into subnodes, click a node in your PivotDiagram drawing, and then click a category in the Add Category list. Each category has four available features. Under Add Category, right-click the category name to access the following features:Add category name??This option does the same thing as clicking the name?— it breaks the selected node into subnodes by that category. Select all??This option selects all the nodes in the drawing that are broken down into that category. Try it! Select a pivot node shape in the drawing. In the Add Category window right-click ShippedQuarter and choose Select All. This selects all pivot node shapes displaying ShippedQuater data, regardless of which shape was initially selected.Edit Data Graphic??This option opens the Edit Data Graphic dialog box, where you can customize the appearance of your data on the nodes. Configure Column??This option opens the Configure Column dialog box (for SQL Server Analysis Services, the Configure Dimension dialog box), where you can filter the rows of your data to a subset that meets your criteria. To remove the filter, reset the box in the Show data where column to (Select Operation). Add TotalThe Add Total list shows the columns in your data source that can be summarized and listed in the nodes. For example, you may want to show the total sales made by each sales person while also showing the number of orders that each sales person handled.In addition to the columns from your data source, Add Total includes a Count item (except for SQL Server Analysis Services), which counts the number of rows from your data source that are represented in each node.Each item in the Add Total list has six available features. Right-click the item name to access the following features:Sum??This option adds the numeric values of all the rows contained in each node. Avg??This option calculates the average of the numeric values of all the rows contained in each node. Min??This option shows the minimum value of all the rows contained in each node. Max??This option shows the maximum value of all the rows contained in each node. Count??This option shows the number of rows contained in each node. Configure Column??This option opens the Configure Column dialog box (for SQL Server Analysis Services, the Configure Dimension dialog box), where you can rename the column and filter the rows of your data to a subset that meets your criteria. To remove the filter, reset the box in the Show data where column to (Select Operation). Pivot Diagram ribbon tabPivot Diagram menus are separated into six groups on the ribbonData, Format, and Layout groups of Pivot Diagram ribbonArrange, Sort & Filter, and Show/Hide groups of Pivot Diagram ribbonData group:Refresh??Refresh the data in an existing PivotDiagram. To choose which diagram to refresh, select the shapes in the pivot diagram .Refresh All??Use this list item to refresh data for all PivotDiagrams in the drawing. Change Data Source??Displays the Data Selector dialog where a different data source can linked. Data Options??Use this list item to open the PivotDiagram Options dialog where you can choose what information about the diagram and how many items in each breakdown will show, change automatic refresh settings, and change the data source. The dialog box is shown below.The PivotDiagram Options dialog Format group:Apply Shape??When you create a PivotDiagram in Microsoft Office Visio Professional 2007, each node appears as a rectangle. You can add a more visually interesting shape to the node from any open stencil. Edit Data Graphic??This command opens the Edit Data Graphic dialog where you can change the placement and style of the data in your shapes. Note: A Data Graphic can be assigned to multiple shapes, so when the Data Graphic is modified, all shapes that use that Data Graphic are updated .Layout group:Re-layout All??Use this list item to refresh the layout after adding or removing nodes. The Re-layout can also be set to automatic. Layout Direction enables the change in direction of the layout of the pivot diagram. The following options are available:Top-to-Bottom (default)Bottom-to-TopLeft-to-RightRight-to-LeftLayout Alignment enables the change in alignment of the layout of the pivot diagram. The following options are available when Top-to-Bottom or Bottom-to-Top Direction is chosen:Left (default)CenterRightThe following options are available when Left-to-Right or Right-to-Left Direction is chosen:TopMiddleBottomArrange group:Move Left/Up shifts the selected pivot node left for nodes laid out horizontally or up for nodes laid out verticallyMove Right/Down shifts the selected pivot node right for nodes laid out horizontally or down for nodes laid out verticallyCollapse??Use this list item to merge child nodes back into their parent node. This command operates only on the selected shape. To reopen the node, select the shape and choose the category to be displayed.Promote??To show only part of an expanded PivotDiagram, you can promote a child node to the top node. This will be covered in more detail in a later section.Merge??This list item combines data from multiple nodes into one. To merge nodes, select them and, on the PivotDiagram menu, click Merge. For example, when displaying sales data for products, display the top selling products separately and Merge the remainder into a single node.Unmerge??To separate merged nodes, click the merged node and, on the PivotDiagram menu, click Unmerge. Note: A merged node has multiple entries in its title bar.Sort & Filter group:Sort & Filter??You can use the Sort feature to change the default order of the subnodes in a PivotDiagram. This is very useful if you want to more prominently display nodes maximum values. For example, if sales data is presented by sales person, the sales person with the most sales can be listed first.Filter??This is the same as choosing Configure Column from the Add Category section of the Pivot Diagram window.Show/Hide group:Show Window toggles the display of the Pivot Diagram window.Title toggles the display of the title of the data source for the Pivot Diagram Data Legend toggles the display of the Data Legend shape which shows information about the data source and which filters are currently appliedBreakdown Shapes toggles the display of the breakdown shapes which are positioned between a parent node and the children of that nodeCollapsing and Merging nodesTechniques such as Collapse, Merge, and Delete are ways to change how the data is displayed in a pivot diagram. None of these techniques are destructive to the data itself. For example, if a pivot node is deleted (other than the topmost node), it can be easily regenerated from its parent again by displaying its bine PivotDiagram nodes using MergeYou can combine the data from multiple nodes into a single node in your PivotDiagram.For example, let's say that you have quarterly sales data broken down by salesperson, but 3 of your 10 salespeople have been with the company for only a few weeks. It is too soon to compare the new salespeople to the more experienced staff, so you decide to combine their nodes into one.Hold down the SHIFT key and select the nodes that you want to combine. On the PivotDiagram tab, click Merge. To separate the nodes again, click the merged node and, on the PivotDiagram tab, click Unmerge. Note: A merged node has multiple entries in its title bar.A merged node does not persist if the parent is collapsed and then reopened or if the merged node is deleted and then the parent reopened.Other techniques for combining/collapsing nodesUse the Collapse command to close all child nodes for the selected shape.Any node can be deleted from the display simply by selecting the node and choosing Delete. Selecting a node and deleting it removes both the node and all of its children.Use Configure Column to filter data from being displayed. The filter will have to be removed in order to see the data again.Promote Nodes to RootTo show only part of an expanded PivotDiagram, you can promote a child node to the top node. The promotion process applies filters that hide the data above the promoted node.For example, let's say your PivotDiagram shows the sales data broken down by financial quarter, with your fourth-quarter data broken down by salesperson, but you need to focus on the wide difference between the sales made by two different salespeople. You can promote the node for the fourth quarter so all the nodes above it are hidden.Promote a node to top nodeIn your drawing, click the node that you want to promote and, on the PivotDiagram tab, click Promote. The filters that were applied to promote the child node appear in the data legend. Only the promoted node and its children are now visible in the PivotDiagram.Revert to original top nodeYou can revert to the original top node by removing the filters that were applied.In the PivotDiagram window, under Add Category, right-click the category that you want to remove the filters from, and then click Configure Column. Right-click the categories that have filters applied to them. These categories are listed in the data legend shape in your drawing. If you don't see the data legend shape, expand the Data group in the PivotDiagram tab. In the PivotDiagram Options dialog box, select the Show data legend and Show applied filters check boxes. In the Configure Column dialog box, under Filter, under Show data where category name, click the first column in each row, and then click (Select Operation). Lab 2.4: Pivot Diagram – Filter a Sales database to analyze business informationThe lab provides an in depth look at working with pivot diagrams and should take about 45 minutes.Scenario: You have a meeting in 45 minutes and your boss asks you to review the past years sales data and asks that you present the following data:What are the annual sales by category? Are there any insignificant contributors?Which were the top 5 selling products for the year?Did their sales increase or decrease from quarter to quarter?Which of these five had the best 4th quarter? (We want to show just these five in the diagram and sorted within the 4th quarter.) Which were the bottom 5 selling products for the year?Did their sales increase or decrease from quarter to quarter?Do category sales change much from quarter to quarter?Approach for answering each question:Create a pivot diagram from the data source Northwind.mdb in the Labs folder. For the Table choose Product Sales for 1997. From the Pivot Diagram window, under Add Totals, make sure that Product Sales is checked.From the top level pivot node, pivot on CategoryName. The sales data is displayed in the pivot nodes.From the top level pivot node, pivot on ProductName. Sort the results to find the top five. Merge these five products together.Promote them. This filters all other data out of the diagram.Now break the data down by product and by quarter. Experiment with the layout features to make the data more presentable.Sort the data for the 4th quarter to the best selling of the top five products for that quarter.Look at the Legend shape to identify the filters that were applied when the data was Promoted.Remove all filters. In the Pivot Diagram window right-click ProductName and choose Configure ColumnFrom the top level pivot node, pivot on ProductName. Sort the results to find the bottom five.Merge the bottom five together. Delete the other pivot nodes at the ProductName level. You should now have the top level node and one merged node for the bottom five products at the ProductName level.Is this equivalent to the Merge and Promote process we did earlier? Right-click the merged node and pick ShippedQuarter. Do we get just the data for the five lowest selling products?No, because while deleting a node takes that image out of the picture, the data is still part of the pivot data so subsequent operations may bring it back. When we did step 3, the promotion process applied a filter, which stays in effect until removed.From the top level pivot node, pivot on CategoryName. Break each category down by quarter.Built in Solutions ReviewQuestionsTrue or False: The Process tab is only available in Visio Premium.Which command is used to break out a collection of shapes from a flow diagram, move them to a new page, and replace them with a Subprocess shape?True or False: Validation issues can be ignored when creating Visio diagrams.True or False: Validation issues can be ignored when exporting SharePoint Workflow diagram.What data type are ShapeSheet formulas always stored as?Name three different types of ShapeSheet cells that you can link database fields to.What one thing must occur to construct a valid database linkage?What is the best way to make connections between a position shape and the manager shape to which it reports?Name the different sources of information that the Organization Chart Wizard can use to create an organization chart.Can the organization chart wizard be run in a non-interactive mode?When a Pivot Diagram is first created, what three elements are added to the Visio drawing?What are two ways to break a pivot node down by a category?How do you apply a filter?AnswersTrueChoose Process > Create from Selection.TrueFalse. SharePoint Workflow drawings must be valid before they can be exported.StringsShape Data, User, any other named ShapeSheet cell.At least one connection must be made between a field in a record and a Visio Shape Data row to construct a valid database linkage.Drop the position shape on the manager shape. The connections will be made automatically.Text files, Excel spreadsheet, ODBC compliant data source, and Microsoft Exchange server.Yes. The wizard can be run in silent mode.The top level pivot node, a data legend, and the name of the pivot diagram.One, with the shape selected, from the Pivot Diagram window choose a category from Add Category. Two, right-click the shape and choose the category.One, right-click the breakdown shape and choose Configure Column. Two, in the Pivot Diagram window right-click the category and choose Configure Column.Also, when using the Promote command, filters are automatically applied.Publishing DiagramsIt is very easy to create drawings with Visio, but for others to view and edit those drawings, at least in their native form, has always required a license for Visio. However there are many options for getting information that has been captured in a drawing into the hands of other users. Determining which method is best depends on the amount of access to the data is needed by others. If the data only needs viewing, then a print or use of the Visio Viewer could be sufficient. If the drawings need to be interrogated for shape data, but not modified, then saving as a web page or as a web drawing or just using the Visio Viewer will do the job.Visio Services, new for SharePoint 2010 allows the rendering of Visio drawings which have been saved as Web Drawings in a browser. For data connected drawings the data can be refreshed and the drawing updated automatically without republishing the drawing.The Visio environment comes with a complete development environment for creating your own shapes, stencils, and templates. With a good software development platform like Visual Studio .NET, the extensions that can be created for Visio are almost limitless. But which solution type do you choose and how do you get your solution into the hands of others.These are the topics of this module.ObjectivesAfter completing this module you will be able to:Describe the variety of ways to publish and view Visio dataSave diagrams as Web Drawings for use by Visio ServicesDescribe the different options available for creating Visio solutions and the important issues related to deploying those solutionsVisio ServicesVisio Services is a new feature of SharePoint 2010 that expands the audience for Visio drawings and enables the use of these drawings in doing real time data analysis. Visio Services lets you:View diagrams in the browser without needing Visio on the client machine Refresh data-driven diagrams in the browser Integrate diagrams into SharePoint applicationsFigure 3 - Workflow for publishing and viewing drawings with Visio ServicesStep 1: Create a drawing in VisioThe real power of Visio Services comes through with data-connected drawings, but this isn’t a requirement. Any Visio drawing can be saved as a Web Drawing. A Web Drawing is a new file type for Visio 2010. It is a zipped container holding the native Visio drawing file (.vsd) and the rendered forms of the drawing in XAML and PNG formats. Note: Visio Professional or Visio Premium is required to save a drawing as a Web Drawing.Step 2: Upload the .vdw file to SharePointThis step can be handled in two ways:Save a drawing in .vdw format and then upload the drawing to SharePoint from outside of Visio.Create a Visio Web Drawing using File > Share > Save to SharePoint and specify the file type as Web Drawing. This gets the job done in one easy step from within Visio.Step 3: User requests diagram from SharePointTo view the drawing in a web browser, the user simply clicks on the file name in the SharePoint document library.Step 4: Visio Services refreshes the data and the diagramBefore Visio Services renders a data-driven diagram it fetches the diagram's linked data from an external data source and updates the diagram visuals based on the updated data. Thus once the drawing is posted to SharePoint it no longer needs to be republished just because the data has changed. Step 5: Diagram is rendered in the browserThe drawing is rendered in full fidelity (XAML) if Silverlight is installed or as a PNG file if Silverlight is not installed. The user can pan, zoom, change pages, follow hyperlinks and view shape data from the browser. There is also an “Open in Visio” button which allows the drawing to be opened in Visio if Visio is installedThe user can view the drawing:…in any browser (Internet Explorer, Firefox, Safari etc…) …on any platform …without leaving the browser …without installing Visio, the Viewer or the Drawing Control …without needing to accept multiple dialogs or browser warningsVisio Services supports refreshing diagrams connected to one or more of the following data sources: SQL (using either Kerberos, Single Sign On & Unattended Authentication) SharePoint Lists Excel Workbooks hosted in SharePoint Any OLEDB/ODBC data sources that have recent driversPublishing Diagrams to Visio ServicesVisio Web Drawing (*.VDW) files are created using Visio Professional 2010 or Visio Premium 2010. The Visio Web Drawing (*.VDW) is a new Visio file type that allows diagrams to be rendered in full fidelity in the browser using Visio Services on SharePoint 2010. When you save a file in Visio 2010, you will see the option in the Save As dialog to save your diagram as a Web Drawing. You can also create a Visio Web Drawing using File > Share > Save to SharePoint. This tool allows you to quickly select a SharePoint location and the Web Drawing file type for saving your diagram.Clicking on Save to SharePoint at the bottom of the billboard opens the Save As dialog so you can confirm or refine your selection. To use the default publishing options, press Save. You now have a diagram ready for viewing in the browser! By default, Visio automatically opens a browser so you can see your diagram as others will see it in the browser. You can turn off this behavior from the Save As dialog. You can also click on Options at the bottom of the Save As dialog to launch the Publish Settings dialog. Using this dialog, you can select the pages that display and, for data connected diagrams, the data sources that refresh in the browser.Visio Services allows you to refresh data-driven diagrams in the browser to present the most up-to-date view of the underlying data. The data sources selected in the Publish Settings dialog will be the data sources that refresh. Visio Services supports refreshing the following data sources:SQL Tables & Views WSS Lists Excel Workbooks hosted in SharePoint Generic OLEDB/ODBC data sources In addition to giving you the option to customize your publish options, the Publish Settings dialog also indicates publishing issues. For example, in the image above, the data source titled “Sales data” has a warning icon beside it. This sales data is stored in a local Excel Workbook: this data source is not supported by Visio Services because it is stored on a local machine. If you want the data from an Excel Workbook to refresh with Visio Services, you should save the workbook to a SharePoint site, link your diagram to the workbook on SharePoint and then save your diagram to the SharePoint site.On save, Microsoft Visio 2010 generates a Web Drawing file which is in fact a package containing:the native Visio representation of the diagram (a .VSD file), used to edit the file in Visio, and meta data re-generated on each save, used by Visio Services to render the web drawing in the browser. Once your Visio Web Drawing file is saved to SharePoint, you can continue to work with it in Visio. Visio Professional 2010 and Visio Premium 2010 both fully support Visio Web Drawing files. This means that you can edit Visio Web Drawing files using the complete set of features provided by Visio.Save as Web Drawing using automationAlong with the Web Drawing (.vdw) file format is a new object for managing the publishing options when automating the publishing process. Use it to specify the pages and records to be published with the drawing. These are analogous to choosing the option File > Share > Save to SharePoint > Web Drawing. Choose Options and select the pages and Data Sources to be published.The following sample uses the ServerPublishOption to save a drawing as a .vdw file. Pages to publish are specified in an array of String with the array holding the page names. Recordsets to publish are held in an array of Long with each array value being the ID of the data recordsets to publish. Below is sample code for saving a drawing as a Web Drawing. It publishes pages 1 and 3 along with a data recordset with ID 1.Sub SaveAsVDW() 'set the pages to publish Dim PageNamesU(1) As String PageNamesU(0) = "Page-1" PageNamesU(1) = "Page-3" Application.ActiveDocument.ServerPublishOptions.SetPagesToPublish _ visPublishPageSelect, PageNamesU, visLangUniversal 'set the recordsets to publish Dim RecordsetIDs(0) As Long RecordsetIDs(0) = 1 Application.ActiveDocument.ServerPublishOptions.SetRecordsetsToPublish _ visPublishDataRecordsetSelect, RecordsetIDs 'save the file Application.ActiveDocument.SaveAsEx _ "C:\Users\Fred\Desktop\Sample.vdw", visSaveAsWS + visSaveAsListInMRUEnd SubIntegrating Visio drawings into SharePoint ApplicationsVisio Services enables you to embed Visio Web Drawings, regardless of whether they are static or dynamic, into SharePoint applications. Depending on your skill level with web technologies there are three scenarios for doing this. Slightly different skill sets are required for each scenario.Visio Web Access web part. Scenario: Embed Visio diagrams into SharePoint pages. Skills required: know how to create a web part page in SharePoint.Web Part Connections. Scenario: You can enable limited interactivity between the Visio Web Access web part and another on the page, without code. A typical example of this type of interactivity is to trigger one web part to show extra relevant information about a particular shape when it’s clicked in the Visio web part.Skills required: know how to create a web part page in SharePoint as well as how to set-up Web Part Connections.The Visio Services Mash-up APIScenario: You can enable rich interactivity on your web part page by manipulating the different Visio web diagram objects programmatically. A typical example of this type of interactivity is to show custom visual overlays when the person viewing the diagram hovers over a particular shape. Skills required: know how to code JavaScript and/or ASPX pages.Visio Web Access Web PartPublished diagrams are displayed to the user using the Visio Web Access Web Part. This Web Part provides the interface that allows a user to view and navigate published diagrams from within their browser. Add this Web Part to any of your Web Part pages in SharePoint to incorporate Visio diagrams into your dashboards or SharePoint application. To add an instance of the VWA Web Part to your Web Part page simply select the zone on the page and from the Insert tab on the ribbon choose the Web Part option. From the list of categories choose Office Client Applications and then Visio Web Access from the list of available Web Parts. Figure 4 - Adding the VWA Web Part to a zoneAfter you add the VWA Web Part to your page you will need to configure each instance of the VWA Web Part by setting any necessary properties using the Modify Shared Web Part option. Figure 5 - Modify Shared Web PartIn order to display a particular Visio diagram in this instance of the VWA Web Part you must set the Diagram URL property. This property must point to a VDW diagram as this is the only file format that the server can render. If you choose any other file format you will see an error in the Web Part. The Diagram URL property must also point to a location on the same server, it cannot refer to a document on an external site. Figure 6 - Setting the Diagram URL propertyOnce the Diagram URL property has been set and you click on the OK or Apply buttons the target diagram should be rendered in the VWA Web Part.Figure 7 - Rendered diagramThe Visio Services Mash-up APINot only does SharePoint 2010 provide Visio Services functionality to render Visio diagrams in the browser, it also supports extensibility allowing developers to build server based applications that incorporate Visio diagrams. This new API allows developers to interact with a diagram that is hosted in an instance of the VWA Web Part, providing: Diagram navigation such as setting the view and zoom level Shape selection including notification of selection changed Highlight functionality to highlight shapes Overlay functionality to add additional markupShape data access to query individual shape data fields Hyperlink access to query individual hyperlinks on each shape The Mashup API is a browser-side JavaScript API with an easy to learn object model and support up to JavaScript 1.3 as this version of JavaScript is compatible with most browsers.Figure 8 - Mashup API Object ModelThe object model shown above lists all of the objects that are available in the Mashup API however all of the methods and properties are not documented here. Note: Because it is very new, at the time of this writing it was unclear just where the Mashup API would be published. It may become part of the Visio 2010 SDK, but the reader should do a search to find the Mashup API documentation.Walk through – Building a dashboardNow that we have our basic Web Part page (created above) that is displaying an instance of a published diagram using the VWA Web Part, lets add additional functionality to this Web Part page using the new Mashup API. For this particular example we will add two additional enhancements to our Web Part page: Selecting a shape in the diagram will present the user with additional information that is stored in ShapeData for the selected shape. This is data that is of interest to users of this dashboard. Allow a user to filter the shapes in the diagram by using the Highlight functionality of the Mashup API to highlight shapes in the diagram that meet specific criteria. In order to provide the capabilities described above we will need to edit our Web Part page and add another Web Part that will contain the JavaScript code and HTML. Edit the Web Part page and insert a Content Editor Web Part in the Right Column zone on the page.Figure 9 - Adding the HTML Form Web PartOnce this new Web Part has been added to the page you will need to use the Edit Web Part option to access the properties of this Web Part.Figure 10 - Edit Web Part to link JavaScript sourceIn order to attach the code to this Web Part, insert the URL of the JavaScript file into the Content Link property, clicking OK to accept the changes.Figure 11 - Set the Content Link property to the URL of the JS fileNote: To get the URL, use the Copy Shortcut RMA by right-clicking on the JavaScript file in the document library.Figure 12 - Copy Shortcut is an easy way to get the URLOnce submitted the Web Part should update, displaying the HTML controls that are part of this sample code. Not only should the HTML be visible but the JavaScript code is also active at this point so you can test the code before you exit edit mode and make the page available to your users.Figure 13 - HTML Form Web Part rendering our HTML and JavaScriptUpdating other properties of the Content Editor Web Part will improve the user experience. For example, set a Title (under the Appearance group) for the Web Part and you might also change the size of the Web Part for better viewing. When you are done editing the properties of the Web Part you can click OK to close the Web Part Content Editor and exit Edit mode on the Web Part page.Figure 14 - Web Part Page running in Edit modeTo test the functionality that we added using JavaScript you should be able to click on a shape in the drawing and the HTML TextBox controls should populate with property values from the selected shape. Clicking on any of the radio buttons for Status should add a highlight to any shapes on the page with a Status property matching the selected value.Figure 15 - Status property used to highlight shapesWalk through – JavaScript explainedonApplicationLoadThis method is responsible for getting the instance of the VWA control on the Web Part page. Once you have the instance of the VWA control you can call the addHandler() method to connect to the events supported by the VWA control, which for this example are diagramComplete and shapeSelectionChanged. new Vwa.VwaControl("WebPartWPQ3") This returns the named instance of the VWA control on the Web Part page. addHandler(string event, function handler) This method is not specific to the VWA control but allows you to connect functions to events on the target object. event is the name of the event on the VWA control instance "shapeselectionchanged" "diagramcomplete" handler is the name of the function to call. Note: The only gotcha in this method is the name of the VWA control instance. "WebPartWPQ3" in this example happens to be the name assigned to the VWA Web Part instance. Assigned because when you inserted the control on your Web Part page SharePoint assigned this name automatically to the control instance. "WebPartWPQ#" is the format used where # is the next Web Part instance on the page.This id is not available from the UI. The best way to determine the id of the Visio Web Part is to open the source for the page and search for it by searching for class="VisioWebAccess".From the View menu on your browser, choose Source and then in the text editor search for class="VisioWebAccess".Figure 16 - Searching for the Web Part IDonDiagramCompleteThis method is called when the diagram is finished rendering in the VWA control instance. We connected this method to the diagramComplete event in the onApplicationLoad method described above. This method simply gets the instance of the ActivePage from the control and sets a zoom value. This actually turns out to be a good debugging technique that will indicate you were successful retrieving the VWA control instance in the onApplicationLoad method. If your specific zoom value is not set when the diagram renders then you know that you were not successful in getting the instance of the VWA control and you will need to verify the control name that you used. getActivePage() This method returns the instance of the Page object that is the active page in the VWA control instance. shapeSelectionChangedHandlerAs the name implies this is the method that we connected to the shapeSelectionChanged event in the onApplicationLoad method described above. This method is responsible for retrieving Shape Data values from the selected shape and populating the HTML controls on the page. To accomplish this we need to first get the active page from the control (getActivePage). Then we need to get the shapes collection from the active page (getShapes). Once we have the shapes collection we need to get the selected shape by passing the shapeId argument to the getItemFromId method on the shapes collection. Finally, once we have the selected shape, we can call the getShapeData method which will give us an array of the Label and Values for all the Shape Data properties. With the label and values from Shape Data we can populate our HTML controls appropriately. getItemById(string shapeId) This method returns the instance of the shape based on the shapeId argument. shapeId is the Sheet Name used in Visio. getShapeData() This method returns an array of shape data items. The label property of each item returns the value from the Label cell of the Property row of the ShapeSheet. The value property of each item returns the value from Value cell of the Property row of the ShapeSheet. HightlightA nice feature of the Mashup API is the ability to highlight shapes on the active page. The addHighlight() method on the Shape object draws a rectangle around the target shape. You can specify the line weight and the line color of the rectangle. removeHighlight() is responsible for removing a highlight from the target shape. This method is called from the HTML input controls on our page using the onClick attributes (onclick="Highlight()") of each control. Each time a user clicks on one of these controls our Highlight method is called. The first thing our Highlight method does is clean up the active page of any existing highlighted shapes. It walks thru the shapes collection calling removeHighlight() for each shape on the active page. Secondly, our Highlight method uses the value attribute (value="ok") of the clicked HTML control as the filter to determine which shapes to highlight. The method walks thru each shape in the active page’s shapes collection, gets the array of Shape Data from the getShapeData method and determines if the shape has a specific property and value. If so we call the addHighlight() method on the shape. removeHighlight() this method does not accept any arguments. It removes any existing highlights on the target shape. addHighlight(int width, string color) this method adds a highlight rectangle to the target shape as specified by the following arguments width - must be a positive integer. color - accepts “#RRGGBB” formatted values. Complete JavaScript source listing for this walk throughBelow is all the source needed for the functionality described in this article. <script language="javascript"> // hook up Application event handlers var app = Sys.Application; app.add_load(onApplicationLoad); app.add_unload(onApplicationUnload); // hold an instance of the Visio VWA control var vwaControl; var shapeSelectionChangedHandler = null; //---------------------------------------------------------- // Wait till the Visio Web Access HTML & Script has been sent // down from the server, and create a VwaControl Object // (the root Visio Web Access object) for use throughout the // script. // // Also add handlers for the onDiagramComplete & // shapeSelectionChanged we'll for the solution. //---------------------------------------------------------- function onApplicationLoad() { vwaControl= new Vwa.VwaControl("WebPartWPQ3"); // this is the name of the visio Web Part instance on the Web Part page vwaControl.addHandler("diagramcomplete", onDiagramComplete); vwaControl.addHandler("shapeselectionchanged", shapeSelectionChangedHandler); } //---------------------------------------------------------- // Handler for unloading of this page. //---------------------------------------------------------- function onApplicationUnload() { //alert("unloading"); }//---------------------------------------------------------- // Wait till the default page is loaded by VwaControl; get // references to all of these objects for later use during // the script. //---------------------------------------------------------- function onDiagramComplete() { var vwaPage = vwaControl.getActivePage(); vwaPage.setZoom(75); // force the initial zoom level } //---------------------------------------------------------- // On shape selection changed, this function extracts the // Shape Data from a shape and passes it along as a URL // parameter to the HRDataSystem ASPX application that is // being displayed in the EmployeeData IFRAME on the page. //---------------------------------------------------------- shapeSelectionChangedHandler = function(source, args) { // get the selected shape from the shapes on the page var vwaPage = vwaControl.getActivePage(); var vwaShapes = vwaPage.getShapes(); var shape = vwaShapes.getItemById(args); // get the data to display for the selected shape var data = shape.getShapeData(); var strNetworkName = ""; var strIPAddress = ""; var strAdministrator = ""; var strStatus = ""; for (var j = 0; j < data.length; j++) { if (data[j].label == "Network Name") { strNetworkName = data[j].value; continue; } if (data[j].label == "IP Address") { strIPAddress = data[j].value; continue; }if (data[j].label == "Administrator") { strAdministrator = data[j].value; continue; } if (data[j].label == "Status") { strStatus = data[j].value; continue; }}// get the selected state input and set its value var inputNetworkName = document.getElementById('strNetworkName'); inputNetworkName.value = strNetworkName; var inputIPAddress = document.getElementById('strIPAddress'); inputIPAddress.value = strIPAddress; var inputAdministrator = document.getElementById('strAdministrator'); inputAdministrator.value = strAdministrator; var inputStatus = document.getElementById('strStatus'); inputStatus.value = strStatus; }//---------------------------------------------------------- // Highlight method //---------------------------------------------------------- function Highlight() { var vwaPage = vwaControl.getActivePage(); var vwaShapes = vwaPage.getShapes(); var vwaShapeCount = vwaShapes.getCount(); // clean up any existing highlights before we highlight other choices for (var nextShapeIndex = 0; nextShapeIndex < vwaShapeCount; nextShapeIndex++) { var nextShape = vwaShapes.getItemAtIndex(nextShapeIndex); if (nextShape == null) { continue; } else {nextShape.removeHighlight(); } }//--------------------------------------------------- // Go through all controls on the page (could be more // efficient) and find the solution's checkboxes. Then // Highlight the appropriate shapes by assigning // to rackSetToInterate the the appropriate array of // of shapeIds and iterating though them. //--------------------------------------------------- var inputs = document.getElementsByTagName('input'); var strSelectedStatusValue = ""; for(var i=0; i < inputs.length; i++) { // check if the input is a checkbox if (inputs[i].getAttribute('type') == 'radio' && inputs[i].id == "StatusSelector" && inputs[i].checked) { strSelectedStatusValue = inputs[i].value; break; } } // chose the color based on the status selected var highlightColor = "red"; if (strSelectedStatusValue == "ok") { highlightColor = "green"; } if (strSelectedStatusValue.length > 0) { // what we actually want to do here is find the shape based on the ShapeData HealthState property that has a matching // value to the selected input controlfor (var nextShapeIndex = 0; nextShapeIndex < vwaShapeCount; nextShapeIndex++) { var nextShape = vwaShapes.getItemAtIndex(nextShapeIndex); if (nextShape == null) { continue; } else { // inputs[i].value - this is the selected value in the radio control that needs to match the HealthState property in the shape // get the shape data var data = nextShape.getShapeData(); for (var j = 0; j < data.length; j++) { if (data[j].label == "Status") { if (strSelectedStatusValue.toLowerCase() == data[j].value.toLowerCase()) { nextShape.addHighlight(4, highlightColor); } continue; } } } } } } </SCRIPT>Network Name:<br> <input id="strNetworkName" name="NetworkName" style="width: 284px" type="text" /> IP Address:<br> <input id="strIPAddress" name="IPAddress" style="width: 284px" type="text" /> Administrator:<br> <input id="strAdministrator" name="Administrator" style="width: 284px" type="text" /> Status:<br> <input id="strStatus" name="Status" style="width: 284px" type="text" /> <br> <hr> <br> Filter Options <br> <input type="radio" id="StatusSelector" name="StatusSelector" value="ok" onclick="Highlight()">Online</input><br> <input type="radio" id="StatusSelector" name="StatusSelector" value="unavailable" onclick="Highlight()">Offline</input><br> <input type="radio" id="StatusSelector" name="StatusSelector" value="unknown" onclick="Highlight()">Unknown</input><br> <br> <input type="radio" id="StatusSelector" name="StatusSelector" value="none" onclick="Highlight()">None</input><br>Visio Services Additional ResourcesChris Hopkins VisilogChris’ blog provided the code samples used in this section SharePoint 2010 and Visio Services a Visio Process Repository Visio Services Diagrams to Visio Services a Web Drawing in a SharePoint Page and Configuring Visio Services Services overview (SharePoint Server 2010)(office.14).aspxPlan Visio Services security (SharePoint Server 2010)(office.14).aspxPublishing and viewing Visio SolutionsExport Formats Available XE "exporting drawings" The exporting process from Visio is fairly straightforward. One of the more complex parts of this process can be choosing the file format that you want to export to. Granted, in some situations you may know the exact format you need. Other times you may have many formats that will work.When making the decision for which format to choose, you will need to consider the follow:What the ultimate end of the drawing is for (e.g. web publishing)Other applications downstream and their preferred formatsNeed for Vector or Raster information XE "file formats:for exporting" The file formats available from the Save As dialog in Visio 2010 Professional can be broken down into seven main areas:Visio FormatsCAD Vector FormatsRaster Formats Used With WebWeb Page SolutionGeneric Metafile FormatsGeneric Bitmap FormatsPDF and XPS FormatsThe drawing below shows a mapping of these areas to actual file extensions.Filter Conversion BasicsAll file formats in the Save as Type list beyond the Visio formats all go through some kind of filter conversion. With some of the filters you are presented with additional settings after selecting to save the file. One crucial concept to understand with file conversion is that there is an inherent possibility for loss of data when converting images from one format to another. Although the loss might not be evident in some conversions, it will likely be evident in others. Where you might notice this greatest is going from a vector based format to other vector based formats, such as to and from CAD formats. As you recall from other sections in this text, Visio uses a vector-based format. Vector formats define how to draw the image using sets of graphic primitives, lines, polygons, etc. Some formats use graphic entities that may not exist in the other formats at all. As the data gets filtered from one format to another there may not be adequate ways to describe the data in the new format. It is analogous to translating from one language to another, like French to English, where there are words in one language that simply cannot be expressed in the other language.Converting from vector to raster images also involves some possible loss. Generally the image should look pretty similar to the original image, but there is at a minimum a loss of functionality. The image is now a series of dots, not entities that can be edited. Common Filter Options XE "vector filters" XE "raster filters" XE "filters" When you export to some formats you are presented with a screen of additional settings to use in the filter process. Although these settings vary between individual filters, there are some common filter settings. Some filters allow you to access and store selected settings as a “profile”. Described below are some of the common settings for the graphics filters in Visio:Vector Graphics Filter SettingsColor Translation - How to map the colors during conversion, i.e. Inverse. Typical setting is Normal.Line Cap Mode - How should line ends be handled? Device indicates use only line ends supported by the file format and Stroked indicates to try and emulate the line ends.Raster Graphics SettingsGeneral Section (varies by filter)Color SettingsCompression Settings Transformation SectionRotationFlip image horizontal and/or verticalResolution Section - How many dots per inch for the raster image?Screen - Current screen resolution. This is the default setting for resolution.Printer - Current printer resolutionSource - Determined by VisioCustom - Your own settings Size Section - What image size to use for the raster image? Not completely independent from resolution (i.e. Resolution of Screen and Size of printer gives small image, Resolution of Printer and Size of Printer gives image of size equal to display size)Screen - Size of image as displayed by Visio Printer - Size image would print based on current resolution and current printer resolutionSource - Determined by Visio based on what size the image is in Visio. This is the default setting for size.CustomPublish for visualization onlyIf the objective is to produce images that can be viewed, but not interacted with, then the options are exporting to one of the graphic formats or saving the drawing in PDF or XPS formats.Export to GraphicsVisio 2010 supports the exporting of the Visio image into many different graphical file types. In addition to the native XML and binary formats, you can also save your drawing in any of the following formats:Scalable vector graphics (.svg)Scalable vector graphics compressed (.svgz)Autocad drawing (.dwg)Autocad interchange format (.dxf)Web Page (.htm, .html)Web Drawing (.vdw)Compressed Enhanced Metafile (.emz)Enhanced Metafile (.emf)Graphics Interchange Format (.gif)JPEG Interchange Format (.jpg)PDF (.pdf)Portable Network Graphics (.png)Tag Image File Format (.tif)Windows Bitmap (.bmp, dib)Windows Metafile (.wmf)XPS Document (.xps)How to Export Your Drawing XE "drawings:exporting" XE "exporting drawings" Exporting your Visio drawing is as simple as choosing File > Save As from the ribbon and changing the selected file type in the Save As dialog. For many of the options available in the Save As Type list, an additional dialog will be presented with specific settings for the file type chosen. We will cover some of these settings further in this section. XE "menus:File:Save As" You may export the entire Visio drawing page or portions of your drawing. To export a portion of the drawing, select the shapes you want to export and then choose the File > Save As menu option. If nothing is currently selected then the entire drawing page will be exported. XE "dialog boxes:Save As" With the exception of the Save as Web Page option, multiple-page Visio drawings will need to be exported page by page. XE "Save As dialog box" Save As dialog showing some of the Save as type optionsSave as PDF and Save As XPSNewly introduced to Visio 2007, is the capability (available via a separate download) to save a Visio drawing into PDF or XPS format. Installing the free download will add the Publish as PDF or XPS option to the File menu. It will also add the PDF and XPS options to the Save As dialog. Without the download installed these options will not be seen from the user interface.XPS (XML Paper Specification) is a general purpose Microsoft document format, based on the Open Packaging Conventions. These conventions “describe the method for packaging information in a file format, describing metadata, parts, relationships, and the application of digital signatures.” XPS is natively supported in Microsoft Windows Vista, and supported on other platforms through a free downloadable viewer. Note: The XPS viewer can be downloaded from PDFThe addition of Save as PDF to Office 2007 supports overall themes of content sharing and workflows and supporting complete customer scenarios around content. Office-generated PDF fits into these scenarios in a couple of ways: distribution and sharing, where customers can easily create PDF versions of their Office documents for distributing broadly, either online, via e-mail, or printed, and archiving, where customers can preserve their work for later retrieval and reuse. This fits in well with the overall direction Microsoft has been heading with the Office file formats. It’s why Microsoft decided to move to Open XML formats as the default formats, and it’s what motivated Microsoft to build PDF support directly into the products.In order to support these scenarios, the goals for PDF generated by Office 2007 are that it: maintains fidelity to the original, is printable, is accessible, is navigable, and supports the PDF features important to the success of these scenarios.Here is a quick overview of PDF features supported in Office-generated PDF:Native PDF creation—saving as PDF is supported from within Microsoft Office 2007 applications Word, Excel, PowerPoint, Access, Visio, Publisher, InfoPath, and OneNote.Quality/intent settings—Most applications, including Visio, provide support for two “intent” settings: Standard, for publishing files online and printing, and Minimum Size, for online sharing. The intent settings control the level and type of image compression for various image types and font embedding and sub-setting options. Internal and External Hyperlinks—PDF documents preserve internal and external hyperlinks assigned to text and other objects in the original file.Tagging and accessibility features—PDF for most applications includes basic document structure with tagged content elements. The tags support logical reading order, alternative text on images and on text that is represented as an image in the PDF output, and Unicode representation for nonstandard glyphs.Document outline—also known as “bookmarks” used for document navigation in PDF viewers.Document properties—Metadata properties associated with the file.To save or publish a drawing in PDF format:Choose File > Save As and then select PDF as the Save as typeOnce the dialog appears the Options button may be chosen for setting various output optionsSelect Save.Save as > PDFXPSXPS, or the XML Paper Specification, is Microsoft’s new electronic paper format for exchanging documents in their final forms. This is a Microsoft Office feature that provides a one-way export from Office client applications such as Visio to an application- and platform-independent, paginated format. Unlike the Office Open XML Formats, XPS does not attempt to capture the full structured richness of an Office document. As an electronic paper format, its purpose is to provide a high fidelity representation of the output only. Because of this, creation of an XPS document from Office is a one-way, export operation.Why is this important?XPS is an electronic paper format built around the same Open Packaging Conventions document structure as the new Office file formats. This means a Zip container and XML content. As such it plays well with other technologies like Microsoft Information Rights Management (IRM) and is open to developers to read and write, using APIs in the Windows Presentation Foundation or any other tools capable of working with XML and Zip. This openness makes XPS convenient for a range of scenarios in which it is useful to inspect or modify the contents of the “paper” programmatically. How does this relate to the XPS print driver?The Windows Digital Documents team is delivering a print driver with Windows Presentation Foundation that will enable all applications that can print to create XPS files. The support for XPS output in Office 2007 goes beyond what is typically passed to a printer, including the supporting information to enable, for example, working hyperlinks, searching, efficient representation of transparency and gradients, accessible documents, and document rights when the source document has restricted IRM rights.How do I view an XPS document?An XPS viewer is required. Microsoft is delivering viewers for Windows Vista and down level versions of Windows, with Windows Presentation Foundation, and directly or through partners, for a range of other platforms. The XPS viewer can be downloaded from information about XPS is available from the following sources:There are a couple of good blogs on MSDN that provide information on the development of XPS and its use in Office 2007? MSDN article titled “A First Look at APIs for Creating XML Paper Specification Documents”, by Bob Watson. Also note the sidebar with this article called “Three Paths to High Fidelity”. save or publish a drawing in XPS format:Choose File > Save As and then select XPS as the Save as typeOnce the dialog appears the Options button may be chosen for setting various output optionsSelect Save.Save as > XPSLab 2.5: Exporting to other formatsCreate PDF and XPS files. What are some things to look for and what are some limitations?Lab Objectives:What are the differences (if any) in creating these two types of output?Explore the options available for creating PDF and XPS files.Explore the features of working with PDF and XPS filesExercise: Create PDF and XPS filesCreate a multi-paged Visio drawing or use one of the sample files. Try orienting some of the pages in different directions or make the page sizes different.Save this drawing in PDF output. Open the PDF just created, traverse the drawing pages. Save the drawing again, but this time choose the Options button and choose different options. Open the PDF and note any differences. Search for a text string in the resulting PDF. Is the search case sensitive?Save this drawing in XPS output. Open the XPS just created, traverse the drawing pages. Save the drawing again, but this time choose the Options button and choose different options. Open the XPS and note any differences. Search for a text string in the resulting XPS. Is search case sensitive?Publish for visual dataWhen the objective is to create Visio data in a form that can be interrogated (to a limited extent) without requiring the user that is viewing the drawings to have Visio installed, the options are Save as Web Page or use the Visio Viewer.Save as Web Page (HTML)One special type of export available from Visio is the Save as Web Page option on the File menu. This export varies from the previous export options discussed in a number of ways. Even though the file extension listed is *.htm, *.html, there are many files generated with this export rather than simply one html file. The html file created references the other files that are generated for the output. By default, there is actually a folder created with a name matching the html file that contains all of the supporting files referenced by the html file. The Save as Web Page is actually a complex solution involving many dialogs and options for inputs and generating many files as the output. XE "publishing on the web" This export uses other filters when generating its output. Since an HTML file is not a graphics file, the image from your Visio drawing must be saved in a graphics file format that can then be displayed on the new web page. The types of graphics files that the Web Page solution can utilize include the common raster formats used on the web, GIF, JPG, PNG, as well as a vector web format called VML. By default, if you are using Internet Explorer 5.0 or greater, the selected format will be VML and a second format, GIF, will be used as well for compatibility of your generated web page with older browsers. Effectively a dynamic web page and multiple graphics files are exported. Note: Settings from the graphics filters for GIF, JPG, and PNG are shared with the normal exports for GIF, JPG, and PNG.This export works on multiple page documents with one export rather than only one page at a time. The generated HTML page can automatically have navigation added to go between exported pages.This export makes use of XML and some advanced features of web browsers to expose Visio drawing data and multiple hyperlink information with the HTML output file. Data you add to shapes as Shape Data can now be viewed in the web browser as you mouse over a shape. In addition, multiple hyperlinks for each shape may be accessed from the web browser. Clicking on a shape with multiple hyperlinks will bring up a list of the hyperlinks for the shape for individual selection. Note that for older browsers, only the one hyperlink set as the default hyperlink will be visible. Note: Choosing File > Save As and then selecting Web Page from the Save as Type list box is the same as selecting File > Save as Web Page. In each case the Save As dialog box is displayed and the Publish button is added in the bottom right portion of the dialog.Export should generally begin from the Save As dialog by pushing the Publish command button rather than the Save button. The Publish button takes you to the dialogs for setting the options for Web Page solution. The Save button will generate a new web page with the options that were set the last time the Publish command was used.Shape data and multiple hyperlinks are availabe in Visio files exported to a Web PageSave As Web Page OptionsWhen you select the Publish command button you are taken to a dialog box for the Save as Web Page solution. There are two tabs on the dialog box, General, and Advanced. The General tab allows you to decide which pages will be exported from your Visio drawing. You can select individual pages in a range or the entire document. Also available are a choice of publishing options including:Details (shape data)Go to Page (navigation control)Search PagesPan and ZoomOn the Advanced tab the output formatting options are chosen. These include: VML, SVG, JPG, PNG, and GIF. This is where you determine which graphics format will be used for the web page. Selecting VML or SVG for your primary output type allows you to select a secondary output type for compatibility with older browsers. Filter settings for PNG, JPG, and GIF can be altered by doing a separate export directly through the filter before running the Save as Web Page solution.In the Display Options section under the Advanced tab you can choose the screen size, but note that this option only works for the PNG, JPG, and GIF options.Also in the Display Options of the Advanced tab the Style sheet can be set. The Style sheet controls the color choices of the publishing options chosen on the General tab.Save as Web PageTry It! Publish to the WebIn this exercise, make a Visio drawing ready for web publication using the Save as Web features. In the process explore the publishing options.Create a simple Visio drawing or open one of the sample files. It should have multiple drawing pages. It should also include Shape Data.Choose File > Save as Web Page. Choose VML as the output format and view the results in the web browser.Choose SVG as the output format and view the results in the web browser.Choose GIF as the output format, change the target monitor to a different size, and view the results in the web browser.Set the Style sheet option and view the results in the web browser.Visio ViewerOverviewThe Visio Viewer 2010 enables anyone to view Visio 2010 (and earlier) drawings inside their Microsoft Internet Explorer version 5.0 or later Web browser.Visio users can freely distribute Visio drawings and diagrams to team members, partners, customers, or others, even if the recipients do not have Visio installed on their computers. The Visio Viewer enables users to discover the advantages of using Visio drawings, charts, and illustrations in a Web-based environment. It is particularly useful for teams that need to collaborate from different locations where not all team members have access to the full functionality of Visio 2010.Viewing Visio drawings is as simple as double-clicking the drawing (files with the .VSD, .VSS, .VST, .VDX, .VSX, or .VTX extension) in Windows File Explorer. Internet Explorer will open, and the Visio Viewer will render the drawing in the browser window. You can then pan and zoom in the drawing window by using toolbar buttons, keyboard shortcuts, or menu items in the right-click menu. Also, you can see properties on any shape by opening the Properties and Settings dialog box and then selecting a shape. Some rendering and display settings are available in the Display Settings tab of the Properties and Settings dialog box. Additionally, drawing-layer visibility and colors can be set in the Layer Settings tab, and annotation visibility and colors can be set in the Markup Settings tab.System RequirementsSupported Operating Systems: Windows 7Windows VistaWindows XPWindows 2003 Server Windows 2008 ServerSoftware Requirements:Microsoft Internet Explorer (IE) 5.0 or later Note: Both Visio Binary (.VSD) and XML (.VDX) files are supported, as well as stencils and templates. Note: The Visio Viewer is implemented as an ActiveX control that loads and renders Visio drawings inside Internet Explorer or in the Microsoft Office Outlook preview window.Non Visio users – viewer/previewerYou can share a Microsoft Office Visio drawing with someone who does not have Visio, as long as they have the Microsoft Office Visio Viewer or the Outlook 2007 Previewer installed.The Visio Previewer in Outlook Because the Visio Previewer is automatically loaded when the user loads Outlook 2007 or later, a user can simply click on the Visio attachment from within the Outlook message. Outlook will offer the user the ability to preview the Visio drawing along with a warning about previewing unrecognized files.To preview the file from within Outlook 2007, simply click the Preview file button and the Figure 17 - Outlook 2007182880182880Visio diagram is displayed in the Outlook Viewing pane.What you can do when previewing a drawingThe Visio drawing is shown in the viewing window of Outlook. Page tabs are displayed so traversing from page to page is easy. A right click on the drawing will display zoom capabilities and a menu to go to another page. Visio keyboard short cuts for pan and zoom are active in the message window.What you cannot do when previewing a drawingThere is no ability to select items in the drawing or change the image in any way. There is no ability to see shape data information in the preview window.Publish for data onlySometimes your only requirement is to be able to get data out of Visio, but not view the drawings. By saving in XML format (Visio .vdx file type) you can then create programs that read text to read and modify Visio data. For example, shape data is stored as text in the .vdx file. It could be read and changed by software using simple text editing techniques. Note: Visio supports the UNICODE character set which enables almost all written languages to be represented using a single character set.Manage Visio files with SharePoint? TechnologiesMicrosoft Windows SharePoint Services is a versatile Windows Server technology that provides rapid, low-cost implementation of information-sharing tools, robust storage and collaboration infrastructure, and a foundation platform for building new Web-based applications and services. More information about Microsoft Windows SharePoint Technologies can be found at SharePoint Services (WSS) is a product that enables workgroup collaboration. It contains basic capabilities to support file sharing, check-in, and check-out. Users can access files stored in a WSS library either from the SharePoint site itself or directly through Visio. Accessing files through a SharePoint site provides a team with Check-in and Check-out capability, and the ability to view and edit files. Editing of data can be done with Internet Explorer or directly within Visio. When editing a drawing through the SharePoint site, the user is prompted to save and Check-in changes or discard changes when the drawing is closed. Using a Visio Process RepositoryThe Visio Process Repository is a new SharePoint site template that is available out of the box with SharePoint 2010. It leverages SharePoint’s collaboration features -- including check-in and check-out, versioning, and workflow -- and integrates with several of Visio’s new process management features. The result is that in just a few clicks, a SharePoint administrator can create a Visio Process Repository that is pre-configured for easy storage and management of Visio process diagrams.Below is the home page of an example Process Repository:As shown in the sidebar above, a Repository site contains a library for documentation, a task list, and a discussion board. But most important is the “Process Diagrams” document library, which is designed to store processes. This document library comes pre-populated with several templates that can be used to create new process diagrams. (However, you can store other diagram types in a Repository; these particular templates are available simply for convenience.)Let’s say you use the Cross-Functional Flowchart template to create the following diagram in Visio:Once you’re finished and (optionally) have checked your diagram for errors using the Validation feature, you can save your document back to the Repository through the “Save to SharePoint” billboard in the Backstage:Then, when you navigate back to your Repository, your process diagram will be listed in the Process Diagrams document library as shown in the image below. Note the two special columns marked by the red rectangles:The Keywords column displays the swimlane headings of each cross-functional flowchart in the document library. The diagram above had swimlanes titled “Engineering” and “Management”; these swimlanes are reflected in the document library below, providing useful at-a-glance information on who is involved in the process. The Category column displays the validation status of each document. This makes it easier for administrators and managers to monitor whether the processes in their Repository conform to their organization’s standards. ?Since the Process Repository is built on top of SharePoint 2010, you can also take advantage of other SharePoint features. For instance, you can configure workflows, set up automatic email notifications for when documents change, and view revision history for a given document. Also, with Visio Services users can view the processes in their browser in a single click, even if they do not have Visio installed on their computers. For instance, this is what the above cross-functional flowchart looks like when viewed in a browser: Publishing ReviewQuestionsWhich output format provides Pan and Zoom capability?Is File > Save as Web Page any different from File > Save and choosing Web Page as the Save as type?Is the Shape Data from the drawing accessible from the published web drawing?Answers Save as Web and specifying VML as the target format. These are the same. The shape data is available when using Save as Web as long as the Details option is checked when choosing the publishing options.Deploying Visio SolutionsThere are many ways to create and deploy solutions for Visio. For example, you can create:A Visio library solution containing Visio stencils, templates, and possibly VBA code.A Visio add-on created as a Visio library file (.vsl). These can be created using C or C++.A Visio add-on created as a standalone executable (.exe). These are stand alone executables that can be launched from Visio.VBA solutions that hold code within the Visio drawing file. A drawing, stencil, or template can each hold code.A Visio COM add-in. These are created using unmanaged environments such as VB6.0 or unmanaged C++.A Shared add-in is an add-in created using one of the .NET languages. They are like COM add-ins but use managed code.A Windows form or a browser based application with an embedded Visio Drawing Control. The drawing control is essentially the Visio engine to which you add your own user interface.A VSTO add-in can be created using managed code. The VSTO add-in requires the VSTO runtime to execute. The VSTO runtime provides AppDomain isolation so that if the VSTO add-in fails, the application that launched the add-in is protected from failure.There are many options available to the developer. Understanding the basic differences between solution types is essential to choosing the best option for your solution.Below is a table that summarizes some of these differences. It comes from an article by Saul Candib which has been published within the MSDN Office Developer Center. See the section List of Additional Resources at the end of this module for a complete reference to this article. COM add-ins Add-ons in .vsl files Add-ons in.exe files Support added in Visio 2002.Support added in Visio 2.0.Support added in Visio 2.0.Can run in-process.Runs in-process.Runs out-of-process.A COM object that implements the IDTExtensibility2 interface, usually a DLL.A DLL with an entry point of VisioLibMain.A standalone executable program.Can be created in any language that can create a COM object and implement an interface (including Microsoft .NET languages).Can be created in languages that can support exporting functions, typically C++.Can be created in any language that can create .exe Automation clients.Can run in multiple Office applications with proper implementation.Visio-specific.Can run in multiple Office applications with proper implementation.Load behavior is defined in the registry. Some examples are Startup or On Demand.Loaded when called.Loaded when called.Can be installed anywhere. Location information is contained in the registry entry.Can be installed anywhere. However, for path discovery, the add-on file path must be added to the Visio Start-up or Add-ons path. For component-published add-ons, location information is contained in the registry entry.Can be installed anywhere. However, for path-discovery, the add-on file path must be added to the Visio Start-up or Add-ons path. For component-published add-ons, location information is contained in the registry entry.Cannot be called from the ShapeSheet. However, can monitor for and respond to marker events raised by the QueueMarkerEvent add-on or the QueueMarker ShapeSheet function in response to user actions (such as the evaluation of a ShapeSheet cell formula). Can be run in response to a formula recalculation (the RUNADDON and RUNADDONWARGS functions).Can be run in response to a formula recalculation (the RUNADDON and RUNADDONWARGS functions).Cannot be run from the Tools menu.Can be run from the Add-ons submenu (Tools menu). Add-ons can also be designed to not appear on the Tools menu.Can be run from the Add-ons submenu (Tools menu). Add-ons can also be designed to not appear on the Tools menu.Cannot be run in response to UIObject objects. However, can monitor for and respond to marker events raised by the QueueMarkerEvent add-on in response to user actions (such as selection of items implemented by using the UIOBject object).Can be bound to a menu, menu item, toolbar item, or accelerator by using the AddonName property when using the UIObject object model.Can be bound to a menu, menu item, toolbar item, or accelerator by using the AddonName property when using the UIObject object model.Can be bound to a CommandBarButton object by using the OnAction property when using the command bar object model, or can handle its Click event.Can be bound to a CommandBarButton object by using the OnAction property when using the command bar object model, or can handle its Click event.Can be bound to a CommandBarButton object by using the OnAction property when using the command bar object model, or can handle its Click event.Cannot be persisted. However, can monitor for and respond to marker events raised by the QueueMarkerEvent add-on in response to user actions (such as actions that cause a persisted event to be raised).Can be persisted in an object's EventList collection by using the Target property of the Event object.Can be persisted in an object's EventList collection by using the Target property of the Event object.Deploy a Visio library solutionA Visio library solution can contain custom Visio stencils, Visio templates, and VBA code. There are two methods for deploying these solutions. The preferred method is to publish the content using a Windows installer file, but the methods using file path discovery which have been available since the very early versions of Visio are still available.Publishing using a Windows installer fileThis method consists of creating an installer file (.msi) using Visual Studio and then setting the install locations for the Visio files using the Visio Publishing tool available in the Visio SDK. Using the Visio Publishing tool was covered in Volume 3 in the section covering the Visio SDK. The publishing tool provides the following key features:Register templates, stencils, and help files with the Visio environmentAdd templates to the featured templates so they can be seen from the Visio Category ExplorerPublish localized versions of the files for multiple languagesPublished content location is stored in the registry so retrieval is faster than with the path discovery methodCan utilize the Windows Installer repair and add-and-remove software featuresPath discovery works only for individual users. Publishing your content makes your solution available to all users.File path discovery methodPrior to Visio 2003, custom templates and stencils could be discovered by telling Visio where to search for certain file types.To set the file paths choose File > Options > Advanced. Scroll to the bottom of the screen and choose File Locations…From the File Locations dialog set the path to Drawings, Templates, Stencils, Help, Add-ons, and Start-up. Multiple paths can be set for each by using a semicolon as a separator between the paths.To deploy a solution using this method copy the files to the desired location and then modify the file paths dialog to find them. A big drawback of this solution is that it must be done on each user’s machine. So if your solution is to be distributed widely, it can be somewhat tedious and error prone.Remove VBA project data from Visio filesBefore deploying a Visio library solution it is prudent to remove any unneeded VBA project data from your Visio files. In Visio 2007 and later a project skeleton is no longer created automatically. However, if you open the VBA project window from your document, even if you don’t add any project data, a project skeleton will be created within your project file. This will trigger any macro security warnings for users trying to use your Visio files.The VBA project data can be removed by first saving the Visio file as a .vdx and then deleting the project tags and any project data using a text editor.Deploy a Visio automation solutionDeploy a Windows Forms solution containing the Visio Drawing controlUse of the Visio Drawing control requires that each end user have a valid Visio client license. The Visio Drawing control is installed whenever Visio is installed so there is no need to include the Visio Drawing control itself as part of the installation package. If you are distributing a solution requiring the Visio Drawing control, then Visio should be installed first on the client machines before installing your solution.Deploy an add-on developed as a Visio Solution Library (VSL)A VSL solutions should be packaged within a Windows Installer file (.msi). Some things to consider before implementing a VSL add-on:The .vsl file runs in the same memory space as Visio. The benefit of this is that it typically gives better performance than solutions that run out of process.On the other hand, because the .vsl runs in the same memory space as Visio, should the .vsl fail, it can cause Visio to fail too.Deploy an add-in created with VSTOVSTO allows the creation of secure add-ins. This means that a VSTO add-in can be isolated and protected from crashes in other add-ins. VSTO add-ins can be digitally signed so they will run when a system administrator sets “Require Application Add-ins to be signed by a Trusted Publisher”. They also operate using the .NET Code Access Security model meaning your VSTO add-in has to be granted Full Trust in order to be loaded by Visio.VSTO add-ins and the .msi file used for installing them can be created with Visual Studio. You must grant trust to the solution assemblies so that the .NET Framework allows them to execute. Evidence for the trust can consist of an assembly’s location, a strong name, a certificate, or a combination of these types of evidence.See the articles, Deploying Visual Studio 2005 Tools for Office System SE Solutions Using Windows Installer. The links are listed at the end of this module in the section called Additional Resources.Deploy solutions for use with multiple languagesDeploying stencil and template solutions for multiple language support can be managed using the Visio Publishing tool available in the Visio SDK. However, even when writing code there are language considerations that should be taken into account. Planning ahead will reduce the amount of work necessary to produce a flexible solution that works across multiple languages. Use universal names when writing codeThere are many objects in the Visio object model. Those that are exposed through the user interface (masters, master shortcuts, pages, styles, and layers) change with each language version. If you had to refer to these objects using their local names, you would have to change your code for each language version of your solution you support.To protect your code from localization issues the following objects have both a local name and a universal name: shape, master, master shortcut, page style, layer, row, and cell. For these objects, refer to their universal names in your solution code. These universal names remain constant between different language versions of Visio 2007. Note: The ShapeSheet presents names of cells using only the universal name.Universal names are always used in the automation interface when working with object properties and methods that end with the character “U”. The table below shows these properties and methods. Property or Method Objects Description CellExistsU propertyShape and StyleDetermines whether a cell exists by using its universal name.CellsRowIndexU propertyShapeGets a cell's row index by using its universal name.CellsU propertyShape and StyleGets a cell by using its universal name.CellU propertyRowGets a cell by using its universal name.ItemU propertyAddon, Hyperlink, Layers, Masters, MasterShortcuts, Pages, Shapes, and StylesGets an object from a collection by using its universal name.Name propertyNote: This is the only property that is used to get a universal name that does not end with "U." CellGets the universal name of a cell.Note: Use the LocalName property to get or set the local name of a cell. For more information about accessing cells, see Accessing Cells in the ShapeSheet Spreadsheet later in this article. NameU propertyAddon, Hyperlink, Layer, Master, MasterShortcut, Page, Row, Shape, and StyleGets or sets an object's universal name.RowNameU propertyCellGets or sets a row's universal name.DropManyU methodPage, Master, and ShapeCreates one or more new Shape objects on a page, in a master, or in a group, by using universal names to identify the shapes. Returns an array of the IDs for the Shape objects that it creates.DropManyLinkedU methodPageCreates multiple new Shape objects on the drawing page that are linked to multiple data rows in a data recordset. Returns the number of shape instances created and an array of IDs for those shapes.GetNamesU methodAddons, Masters, MasterShortcuts, Pages, and StylesGets the universal names of all items in a collection.GetThemeNamesU methodDocumentGets an array of universal names of themes contained in a document.Deploy a Windows Forms solution that contains the Visio Viewer controlThe Visio Viewer can be used to view Visio drawings in native form (both .vsd and .vdx). The viewer is free and no license of Visio is required. Using the viewer the user can pan and zoom in the drawing and can investigate shape data on any shape. Pan and zoom is active and the user can toggle the visibility of layers.Installing the Visio Viewer also provides a Visio Viewer control which can be embedded into a form or into a web browser and programmed against using the control’s automation interface. The automation interface allows access to some additional features of the drawing, e.g., the labels and values of all of the shape data can be extracted via automation.However, the Visio Viewer cannot be used to edit the Visio drawing.Deployment of a solution using the viewer control requires that the Visio Viewer be installed as a separate step before the solution using the viewer is installed.The MSDN Office Developer Center contains a developer reference for Viewer.Additional ResourcesMSDN Office Developer Center - Visio 2010All things related to developing with Visio. As new material becomes available, it should be posted here.(office.14).aspxOverview of Add-ons and COM Add-ins in Visio 2007Summary:???Learn the differences between Visio add-ons (.vsl and .exe files) and COM add-ins, and the benefits and limitations of extending Microsoft Office Visio 2007 with each. Visio 2007 SolutionsSummary:???Learn about publishing content to Microsoft Office Visio 2007 by using a Microsoft Windows Installer (.msi) file and the Visio Solution Publishing Tool. Universal Names and Syntax to Localize Visio 2007 SolutionsSummary:???Learn to use universal names and syntax in your code to localize custom Microsoft Office Visio 2007 solutions easily. Learn to access stencils, templates, and add-ons across differing locales. Visio Add-ins with VSTO 2005 SEA nice summary of the issues from Chris Castillo’s weblog. Visual Studio 2005 Tools for Office System SE Solutions Using Windows Installer (Part 1 of 2).Summary: Learn how to deploy a Microsoft Visual Studio Tools for the Microsoft Office System solution using a Visual Studio Setup project to create a Windows Installer package. Visual Studio 2005 Tools for the Office System SE Solutions Using Windows Installer: Walkthroughs (Part 2 of 2)Summary: Read two walkthroughs about deploying Microsoft Visual Studio Tools for the Microsoft Office System solutions using a Visual Studio Setup project to create a Windows Installer package. 2007 Viewer Developer ReferenceProvides important conceptual information for developing custom solutions for the Visio 2007 Viewer. Solutions ReviewQuestionsWhat tool is used for publishing localized versions of stencils and templates to multiple languages?How can you remove VBA project file information from a Visio document?True or False. A solution using the Visio Drawing control does not require the user to have a license for Visio.True or False. Failure within an add-on created as a VSL can cause the Visio application to also fail.What is the distinction between an object’s name and its universal name in the Visio automation model?True or False. The following line of code will work in all language versions of Visio.If objMaster.NameU = “Chair” Then HandleChairMater()True or False. The Visio Viewer control can be used to edit Visio drawings.True or False. The Visio Viewer control can be used to view shape data values.AnswersVisio Publishing tool available within the Visio SDK.Save the drawing as a .vdx file. Use a text editor to remove the XML tags and the project code.FalseTrue. To create an add-on that will not cause Visio to fail use either an EXE add-on solution, a shared add-in along with a COM shim to create a DLL, a shared add-in created using VSTO.The universal name of an object in the Visio object model does not change depending on the target language installation whereas the local name can change.True. The universal name for the master shape object has been used instead of the local name.FalseTrueSome Important Developer FeaturesThis section covers the topics from the Trust Center and XML that are important for the solutions developer.ObjectivesAfter completing this section you will be able to:Develop solutions using Theme Colors and Theme EffectsIdentify the elements of the Trust Center and how they affect the ability of solution code to executeUsing the macro recorder as a tool for learning about developing with Visio and some of its limitationsUnderstand the changes made to DataDiagramML for Visio 2007Understand the changes made to DataDiagramML to allow for data to be round-tripped between Visio 2007 and Visio 2003. Theme colors and theme effectsThere is an excellent paper by Tim Davenport called Designing Shapes for Use with Themes in Visio 2007. It is listed in the REF _Ref161047913 \h Additional Resources section of this module and covers a few more details than is covered in this section.User issuesWhat is a theme?A theme in Visio is a set of colors and effects that can be applied to a drawing with a single click. Themes are a quick and easy way to give a drawing a professionally designed look.Themes are divided into two parts: Theme Colors and Theme Effects each of which controls specific formats within shapes.Themes are displayed in the Design tab of the ribbon interface. What happens to a shape when a theme is applied or removed?A Theme Color contains color assignments for the following color attributes of a shape:TextLineConnectorFillFill patternShadowAccents 1-5 (covered in Tim Davenport’s paper)BackgroundA Theme Effect contains formatting attributes for:Text FontLine pattern, weight, transparency and roundingFill pattern and transparencyShadow style, transparency, offset, magnification, and directionConnector pattern, weight, transparency, rounding, and arrowhead style and sizeWhen a Theme Color or a Theme Effect is applied the colors and formatting defined within the theme are applied to all of the shapes on a page. Cells within each of the shape’s ShapeSheet are modified to receive the Theme function.Try It!Start by creating a new blank drawing. This will create a blank drawing without any stencils opened. Draw a shape on a page.Look at its ShapeSheet and look at the FillForegnd cell. If it is filled as white, the value will be 1.Select a Theme from the Design tab.Look at the ShapeSheet again. The formula in the FillForegnd cell is Theme(“FillColor2”).Also, a user defined cell User.msvThemeColors and/or User.msvThemeEffects is added to the shape. These cells contain the identity of the theme from which the shape’s Theme function will be evaluated.Each cell controlled by the theme will have a similar formula placed into it.Expand the Theme selection from the Design tab and uncheck Apply Themes to New Shapes.Draw a shape using the drawing tools. If no theme is currently applied to the drawing, the FillForegnd cell will have a value of 1 which it inherits from a built in master. If a theme has been applied to the drawing the FillForegnd cell will have a value Theme(“FillColor2”). If the theme is subsequently removed (by applying the None theme) the cell contents re-inherit from the master.Draw a shape, open its ShapeSheet and enter the value 2 (red) into the FillForegnd cell. The FillForegnd cell now has a local override in the cell and thus does not inherit this cell from a master. The FillBkgrd has a value of 0.Apply a theme to this shape. The contents of the cell after application of the theme will be FillForegnd=Theme(“FillColor2”)+ThemeRestore(0). And FillBkgnd=Theme(“FillColor”)+ThemeRestore(2). If the theme is subsequently removed the cell contents return to their original state. The ThemeRestore function is used to preserve the original contents of the shape so that they may be restored if the theme is removed.What happens to a page when a theme is applied/removed?When a theme is applied new user cells are introduced into the page’s ShapeSheet. The user cells are User.ThemeColors and User.ThemeEffects. These cells contain the identity of the themes applied to the page.In the image above the value of 3 for User.msvThemeColors is referencing one of the built in color themes. User.msvThemeEffects is referencing a custom Theme Effect.How is a theme different from Color Schemes in previous versions of Visio?In earlier versions of Visio, the Color Schemes feature provided users a limited ability to apply formatting themes in templates that were designed to support the feature. To apply Color Schemes to shapes, shape developers had to assign a style to the shapes, selected from a set of hidden Color Scheme styles. When users then applied a color scheme to the drawing, Visio changed the colors used in the color-scheme styles so that any shapes that used styles based on them would also change color.The Theme feature beginning in Visio 2007 uses a completely different approach. A shape does not need to have a style assigned to it to support themes. In fact, the feature does not use styles at all. You can apply themes to any shape or group of subshapes, unless they are protected in some way from themes or formatting. If you draw a rectangle by using the Rectangle tool and then apply theme colors and theme effects to the page, the rectangle immediately takes on all the applicable theme-formatting attributes listed above, and no further action is required on your part. In effect, applying a theme works the same way as applying manual formatting.In Visio 2003, when a Color Scheme is applied the following action section gets added to the page. Note the Action cell with the formula RUNNADDON(“CS”). If a drawing that was created in Visio 2003 is opened in Visio 2007 or later, the RMA Color Schemes… still shows in the menu because this Actions section is still part of the document. Also, the add-on “CS” is included in Visio 2007 so selecting the Color Schemes… menu will still work. This Actions section will remain in the document until a Theme is applied. Once that is done, this row of the Actions section will be removed and Color Schemes will no longer be available for this drawing.How to prevent themes from being appliedThere are several approaches to protecting shapes or individual cells from the effects of applying a theme.The LockFormat cell in the Protection section of a shape’s ShapeSheet locks all formatting of a shape so that it cannot be changed. This includes any formats applied through the user interface as well as formats applied through styles or themes.The LockThemeColors cell in the Protection section of a shape’s ShapeSheet prevents the application of Theme Colors to the shape. This does not prevent changes in formats done through the user interface such as setting the fill color or line weight. It does also not prevent the application of a Theme Effect.The LockThemeEffects cell in the Protection section works like the Lock ThemeColors cell except that it protects against the application of a Theme Effect, but does not prevent the application of a Theme Color of changes in formats through the user interface.Using cells in the Protection section of the ShapeSheet protects the overall shape. The protection of individual formats can be done using the Guard and ThemeGuard functions to protect an individual cell in the ShapeSheet.Wrapping a cell formula with a Guard function protects just that cell from the application of changes made through the user interface, the application of a theme or the application of a style.Try It!Draw a shape and in the FillForegnd cell of the ShapeSheet place the formula Guard(3). This sets the shape’s color to green.Try to change the fill color through the user interface. The shape color does not change.Try to change the fill color by applying a theme color or a style. The shape color does not change and the cell contents are unchanged. Note: In Visio 2010 the roles of the FillForegnd and FillBkgnd cells are reversed. A GUARDed formula in the FillForegnd cell will automatically be moved to the FillBkgnd cell upon the application of a theme.Wrapping a cell formula with a ThemeGuard function protects that cell from the application of a theme. If the cell is changed through the user interface the ThemeGuard remains, but the formula that it wraps is replaced.Try It!Draw a shape and in the FillForegnd cell of the ShapeSheet place the formula ThemeGuard(3). This sets the shape’s color to green.Try to change the fill color by applying a theme color. Nothing happens.Try to change the fill color through the user interface by setting the color to yellow. The cell contents are changed to THEMEGUARD(RGB(255,255,0)) which changes the shape color to yellow. Note that the ThemeGuard function is not replaced so a theme can still not be applied to the shape.Copy a theme from another drawingYou may have gone to the effort of creating a custom theme in a drawing or received a drawing from someone else that has a theme you like. How do you add that theme to a different drawing?The process is very straight-forward. Just copy a shape that has the desired theme applied to it. Paste it into your drawing where you want to add the theme. The shape and the theme are added to the drawing. Now you can delete the original shape and the new theme will remain.Developer issues Designing shapes for themesMany shapes work well with themes without any extra work. However, it is at times desirable to control which color associated with a theme (there are several) gets applied to a shape. For example, there are 5 complementary accent colors in each theme. To apply the second accent color to the FillForegnd cell of a shape enter the following formula into the FillForegnd cell.FillForegnd =THEMEGUARD(THEME("AccentColor2")) Then if the applied theme is changed, the shape will display the second accent color of the new theme.This is particularly useful for group shapes that have several colors associated with the group components.CELLISTHEMED()Applying the CELLISTHEMED function to a shape lets you assign appropriate parts of a theme's formatting to a shape but retain the ability to override other parts of the theme's formatting with your own manually applied formatting. If you subsequently reapply the theme, any manual formatting is overridden and the shape takes on the all theme's formatting.Try It!Draw a shape and in the FillForegnd cell of the ShapeSheet place the formulaTHEMEGUARD(IF(CELLISTHEMED(TRUE),THEME("AccentColor2"),SETATREFEXPR()))If the value of CELLISTHEMED is TRUE, the shape takes as the fill foreground color the theme's Accent 2 color. If you subsequently apply a fill color to the shape manually, Microsoft Office Visio sets the value of CELLISTHEMED to FALSE and stores the manually set color in SETATREFEXPR.Change the fill color through the user interface by setting the color to yellow. The formula in the FillForegnd cell changes to THEMEGUARD(IF(CELLISTHEMED(TRUE),THEME("AccentColor2"),SETATREFEXPR(THEMEGUARD(RGB(255,255,0)))))Try It!Open the Shapes Module 1.vss from the Samples folder for this course. Drop the shape Use Accent Colors onto the drawing page. Subselect the red arrow and open its ShapeSheet. Note the formula in the FillForegnd cell. THEMEGUARD(IF(CELLISTHEMED(FALSE),SETATREFEXPR(THEME("AccentColor2")),SETATREFEXPR(RGB(255,85,85)))). The other arrows have similar formulas. The image below is the shape with no theme applied.Figure 18. Shape Use Accent Colors, no theme appliedIt uses the CELLISTHEMED function to display a shade of red if the shape is not themed and to display the second accent color of the theme when a theme is applied.Apply a theme color to the shape. In the image below the Office theme is applied.Figure 19. Shape Use Accent Colors, Office them appliedSet the theme to None. The shape reverts back to its original colors.Add the shape Use Tint to the drawing. Apply the Office theme color. The image is below.Figure 20. Shape Use Tint, Office theme appliedSubselect the arrow at the 3 o’clock position. The FillForegnd cell contains the formula THEMEGUARD(IF(CELLISTHEMED(TRUE),TINT(THEME("FillColor"),30),SETATREFEXPR(RGB(255,85,85)))) Each arrow has a similar formula that uses a TINT of the “FillColor”. The TINT and SHADE functions provide a way to create a color that is a tint or shade of another color. They adjust the luminosity (the L in the HSL color model) of the color by the integer in the cell formula. This number has a range of 0-240.Add the shape Use Blend to the drawing. Apply the Office theme color. The image is below.Figure 21. Shape Use Blend, Office theme appliedSubselect the arrow at the 3 o’clock position. The FillForegnd cell contains the formula THEMEGUARD(IF(CELLISTHEMED(TRUE),BLEND(THEME("FillColor"),THEME("AccentColor2"),0.2),SETATREFEXPR(RGB(255,85,85)))) Each arrow has a similar formula that uses a BLEND of “FillColor” and “AccentColor2”. The third parameter is a proportion of each color to use. It has a value from 0-1. Note: Tim Davenport’s paper covers more examples of using ShapeSheet functions to control theme colors.Where is a theme stored?Any themes created by the user are stored as a Master on the Document Stencil. However, if you look at the Document Stencil, you won’t see them because the theme master has its Hidden property set to true.These hidden theme masters do show in the Drawing Explorer window under the Masters collection. Note: The built-in themes cannot be seen in the Drawing Explorer window and cannot be changed. They can be duplicated and changes applied to the duplicate.Does a theme have a ShapeSheet and how do I see it?You can access the theme’s ShapeSheet only for themes that are created by the user. The built-in themes are not accessible. Use the Drawing Explorer window to see the user created theme masters. Right click the master and choose Edit Master Shape. A master drawing window is opened. Right click the master shape and choose Show ShapeSheet.The User-defined Cells section of a color theme ShapeSheet is shown below. Note there are cells for each color displayed in the Edit Theme Colors dialog.Figure 22. User-defined cells for a Theme ColorBelow is the User-defined cells section for a Theme Effect. There are cells corresponding to every setting within the Edit Theme Effects dialog.Figure 23. User-defined cells for a Theme EffectDoes a copied theme inherit from the original?No. This can be verified as follows.Duplicate the Office theme color. This will create Office.1.Duplication Office.1 to create Office.2.Edit the main fill color for Office.1 and save the changes. Note that Office.2 is unaffected.Apply a theme through automationThis is done by setting ThemeColors or ThemeEffect property of the page object. Here is example VBA code to set the Theme Color.Sub ApplyTheme() ActivePage.ThemeColors = "Office.1"End SubDuplicate a themeThe built-in themes of Visio are not in the Masters collection of the document. You can copy a theme that is a master within a document’s master’s collection by using the Drop method of the Masters collection. The inputs are a reference to the master to be duplicated and the position of the drop coordinates.Sub DuplicateTheme() ThisDocument.Masters.Drop ThisDocument.Masters("Office.1"), 0, 0End SubYou can create a new theme and then fill in its values through automation with the AddEx method of the Masters object.Use Masters.AddEx() to create a master of type visTypeThemeEffects or visTypeThemeColors. Open the Master.Modify the various msvTheme* cells in the User-defined Cells of the ShapeSheet. See Figure 6. User-defined cells for a Theme Color and Figure 7. User-defined cells for a Theme Effect for a complete list of these user-defined cells.Close the MasterSet Page.ThemeColors or Page.ThemeEffects to apply the new theme to the page.Getting rid of unused themesUnused themes, along with unused data graphics, and unused styles can be removed through the user interface by accessing the Remove Hidden Information menu.To do the equivalent work through automation use the RemoveHiddenInformation method of the document object and pass to it the type of information to be removed.Example: (VBA)Public Sub RemoveHiddenInformation_Example() ActiveDocument.RemoveHiddenInformation visRHIPersonalInfo + _ visRHIStylesEnd SubThe macro above removes personal information and unused themes, styles, and data graphics.Trust Center and Remove Hidden InformationSecurity and being able to trust the programs that run on your computer is becoming more and more of an issue for users. The Trust Center is used to control which programs are allowed to run on your computer. The Remove Hidden Information tool in Visio allows you to depersonalize drawings when saving and sending them to other users.Trust CenterAbout Security Settings and Running Code in VisioCreating secure applications is one of the primary challenges facing solution developers. Users, administrators, and developers are increasingly aware of the potential of unknowingly running code that can be harmful to their computers. It is more important than ever that you help to ensure the integrity of your applications. Starting with Microsoft? Office Visio? 2007, all security settings are Office-wide and are set in the Trust Center (accessed via File > Options). Affected settings include the following:Specifying trusted publishers Specifying trusted locations Loading COM add-ins Loading published and path-discovered add-ons Loading VBA macros Note: In previous versions of Visio, settings were made in the Security dialog box and the Security tab of the Options dialog box (Tools menu). Starting with Visio 2007, these dialogs have been eliminated.About Setting Microsoft Office 2007 Security in a Testing Environment To install and run an unsigned COM add-in, the Require Application Add-ins to be signed by Trusted Publisher and the Disable all Application Add-ins options must be cleared in the Add-ins tab in the Trust Center. To run all VBA macros, including those that have not been digitally signed, the Enable all macros option must be set in the Trust Center. It is strongly recommended that you do this only in a testing environment. After you have completed your testing, set the options back to their original state.In the Macro Settings tab of the Trust Center, you can also set options to Disable all macros without notification, Disable all macros with notification, or Disable all macro except digitally signed macros. About Secure Deployment of Managed COM Add-ins in Microsoft Office 2007To comply with Office 2007 security, managed COM add-ins (COM add-ins targeting the common language runtime) must be digitally signed, and users' security settings should be set in the Office Trust Center to allow add-ins in your Office applications. Additionally, you will need to incorporate into your managed COM add-in project a small unmanaged proxy called a shim to avoid unexpected security warnings. For details, search for "deployment managed add-ins" in the MSDN Library.About Automating the Visual Basic EditorIn Visio 2007, when calling the features of the Microsoft Visual Basic for Applications Extensibility object model, you may receive an error message that programmatic access to the Visual Basic project is not trusted. To prevent this message from appearing, in the Macro Settings tab select the Trust access to the VBA project object model box. By checking this box, macros in any macro-enabled document that you open can access the core Microsoft Visual Basic objects, methods, and properties, which represents a possible security hazard. The recommended behavior is to check the Trust access to the VBA project object model box only for the duration of a macro that accesses the Visual Basic object model. The Trust access to the VBA project object model box should be unchecked after the macro has finished running.Remove Hidden InformationUsing the RemoveHiddenInformation method of the Document object is the equivalent of selecting corresponding checkboxes in the Remove Hidden Information dialog box (File > Info > Remove Personal Information) in the Visio user interface.Useageexpression.RemoveHiddenInformation(VisRemoveHiddenInfoItems)Return ValueNothingexpression???An expression that returns a Document object.ParametersVisRemoveHiddenInfoItemsThe items to be removed. A combination of one or more enumerated values from the VisRemoveHiddenInfoItems enumeration. Enumeration for VisRemoveHiddenInfoItemsConstantValueDescriptionvisRHINone0visRHIPersonalInfo1Removes personal information.visRHIPreview2Removes document preview thumbnail images.visRHIMasters4Removes unused masters.visRHIStyles8Removes unused styles, themes, and other display formats.visRHIDataRecordsets16Removes data recordsets.Sample VBA codePublic Sub RemoveHiddenInformation_Example() ActiveDocument.RemoveHiddenInformation visRHIPersonalInfo + _ visRHIPreview End SubPreventing masters from being removed from a documentSometimes custom solutions store masters in the document stencil so that they are available to the application code at all times. The developer must find a way to prevent these masters from being deleted inadvertently by the use of the Remove Hidden Information Tool.Fortunately the Visio team thought of this scenario and provided the following solution. Tip:Add the User-defined cell User.msvRHIPreventRemoval to the page sheet in the master and set the value to 1. This will cause the Remove Hidden Information tool to NOT remove the unused master.Remove Personal InformationSetting the RemovePersonalInformation property of the Document object is equivalent to setting Remove personal information from file properties on save option under Document-specific settings on the Privacy Options page of the Trust Center dialog.Macro Recorder considerationsThe macro recorder can be used to record actions taken when using the Visio user interface. These actions are recorded as VBA code. Executing the resulting code should repeat the action.More generally, the macro recorder is a great tool for learning how the Visio object model works and for putting together small pieces of code that can later be cleaned up and repackaged into useful tools. The final form of the code generated by the recorder may even find itself into code developed in Visual Studio or some other development environment. Although it will necessarily have to be reformatted, that is not usually a big deal.The important thing is that it makes learning to automate Visio very discoverable – for most things anyway.Unfortunately there are some areas where the macro recorder for Visio 2007 has limited use. The API programmability model for Themes, Data Graphics, and Pivot diagrams does not cover everything that can be done in the user interface so use of the macro recorder in these areas has been short circuited. This doesn’t mean that you cannot automate these features. It just means you have to learn to do it the old fashioned way, by slogging through the object model, reading, and asking questions, instead of being able to get a nice little code fragment generated for you automatically.ThemesWhen the macro recorder is turned on, Edit, Duplicate, and Delete are disabled in the Themes task pane.Data GraphicsIf the Data Graphics task pane is open and the macro recorder is turned on, the task pane is closed.The Display Data on Shapes menu is disabled and the task pane cannot be reopened until macro recording turned off.Pivot DiagramsPivot diagrams continue to operate when the macro recorder is on, but none of the pivot actions are recorded.XML changes for Visio 2007In previously published materials, including the Microsoft Office Visio 2003 SDK, the XML schema for Visio was referred to as "XML for Visio." Starting with Visio 2007, the schema is known as DatadiagramML.A DatadiagramML file is an XML (Extensible Markup Language) document that contains all the components of a Microsoft Office Visio binary file. Much as you can access a Visio document by using Automation or from the ShapeSheet window, you can use XML and supporting tools to access data in a DatadiagramML file.Lesson ObjectivesAfter completing this lesson you will be able to:Identify the elements of DatadiagramML that are new for Visio 2007Understand the mechanism that allows for round-tripping Visio 2007 .vdx files to Visio 2003 and back againUnderstand how custom XML (called SolutionXML) can be stored within a Visio .vdx file Understand how the XML Lite parser is used by Visio 2007XML Schema ChangesNew Elements in DatadiagramML for Visio 2007Because of new features and functions that have been added to Visio 2007, the following new elements have been added to the XML file format.ADODataAutoLinkComparisonDataColumnDataColumnsDataConnectionDataConnectionsDataRecordSetDataRecordSetsLockFromGroupFormatLockThemeColorsLockThemeEffectsPrimaryKeyRefreshConflictRowMapShapePlaceStyleRound tripping DatadiagramML files between Visio 2007 and Visio 2003.Because Visio 2007 introduces several new ShapeSheet cells and functions the following measures have been taken to ensure that Visio 2007 data can be read by Visio 2003 and not lost when resaved by Visio 2003.Support of new Visio 2007 ShapeSheet cells in Visio 2003These new cells do not present a problem for documents saved in binary (.vsd) file format. However, the new XML elements that represent the new cells would not be recognized by Visio in files saved in XML format (.vsx files), because they are not included in the Visio 2003 XML schema. As a resullt, if you attempt to open a Visio 2007 file saved in XML format in Visio 2003, you will get a warning if the XML is trusted (created by Visio); the file will fail to open if the XML is untrusted (created or edited outside Visio). To address this issue, the elements representing the new cells reference the new "vx:" namespace alias, an alias unrecognized by Visio 2003, and thus considered as unknown XML. The file opens, but Visio ignores the contents of these elements. <Shape ID='5' ...> ... <Layout> <ShapePermeableX>1</ShapePermeableX> <ShapePermeableY>0</ShapePermeableY> ... </Layout> <vx:Layout> <x:ShapePlaceStyle>2</x:ShapePlaceStyle> </vx:Layout> ... </Shape>Support of new Visio 2007 ShapeSheet functions in Visio 2003When Visio 2003 loads an XML file created in Visio 2007, it cannot parse new Visio 2007 ShapeSheet functions, and therefore does not recognize any formulas that contain references to new cells or new functions. To address this issue, when you save a Visio 2007 file in VDX format, anytime that a cell contains references to new Visio 2007 formulas and therefore requires that those cells be declared in extended XML format, Visio modifies the file as follows, and as shown in the accompanying example: In the regular XML section, Visio writes the last valid computed value, but not the formula. In the extended XML section, designated by the "x:" namespace, Visio writes both the last valid computed value and the new formula.<Shape ID='1' ...> <XForm> <PinX>4</PinX> <PinY>8.125</PinY> ... </XForm> <x:XForm> <x:PinX F='NEWFUNC()+1.5'>4</x:PinX> <x:PinY F='NEWFUNC2()*Width'>8.125</x:PinY> </x:XForm> ... </Shape>This ensures that Visio 2003 loads VSD and VDX files in the same manner. When it loads the files, Visio writes the extended XML sections as string data stored with an individual shape, as it would any other unknown XML. The last valid computed values are correct, but the formulas specific to Visio 2007 are re-evaluated in the event editing by a user in Visio 2003 forces Visio to recalculate. In the event you open a Visio 2007 VDX file in Visio 2003, save it as a Visio 2003 VDX file, and then reopen it in Visio 2007, the formulas in the extended XML sections of the VDX file match the original formulas specific to Visio 2007 only if both of the following conditions are met: The last valid computed values in the regular and extended XML sections match each other exactly (indicating that no recalculation has taken place). The current value is a trivial formula (for example, a formula that evaluates to a constant).Embedding custom XML in a DatadiagramML fileYou can include custom XML data specific to your solution within your DatadiagramML file, provided the data contains well-formed XML that complies with the DatadiagramML schema and the internal rules of Microsoft? Office Visio?.You can embed custom XML in a DatadiagramML file in two ways: As unknown XML, which is XML that Visio does not understand, but will round-trip with a DatadiagramML file when contained in particular elements. This is the means Visio uses to roundtrip documents between Visio 2007 and Visio 2003. As solution XML, which is well-formed XML contained within a SolutionXML element that provides a standardized means of persisting solution data. At the document level, you can store XML data by using the SolutionXML element contained immediately within the VisioDocument element. You can manipulate the document-level XML data in your solution at run time by using Automation. At the cell level, you can store well-formed XML data in selected cells by using a string value within a SolutionXML element. When you work with XML data in cells in the ShapeSheet spreadsheet or by using Automation, you can retrieve your XML data as you would any string value in a cell.XMLLiteVisio 2007 uses XMLLite to read and write Visio xml files. XMLLite is a light weight (very small and it has no dependencies) .dll that is designed for performance. However, to achieve great performance, XMLLite is also “lite” on validation.Generally, XML usage scenarios can be generally divided into two categories:Some scenarios work with XML documents that come from external sources, and it is not known whether the XML documents are valid. In these scenarios, verification of validity is important. Typically, developers use XSD schemas or Document Type Definitions (DTDs) to verify validity. Performance may be a concern, but the overriding concern is that the application reading the XML receives a valid document. Saving and loading documents from and to a variety of applications is a usage scenario that falls in this category.Some software systems use XML as a data store or a means for communication. In these scenarios, the developer knows that the XML document is valid, perhaps because another part of the system (which is under the control of the same developer or organization) generated the XML. The question of document validity is not an overriding concern. One example of this approach is where the software system runs on a server farm, and XML is used to communicate between various servers and processes. Another example might be one where a relatively complicated application has to store and retrieve a large amount of information. The developer completely controls the format of the XML document.The focus of XmlLite is on performance. Therefore, XmlLite is most appropriate in the second of the two scenarios. XmlLite enables developers to write efficient (fast) code to read and write XML documents. In most scenarios, XmlLite parses faster than either the DOM in MSXML or SAX2 in MSXML. Reading and writing Visio XML and SolutionXML is like the second of the two scenarios, where the potential risk for bad XML is low. In Visio 2007 the XML parser validates any XML written during the Save operation. XMLLite is included in Vista, but must be downloaded for Windows XP and Windows Server 2003. When Visio is first launched on a Windows XP(SP2) or Windows Server 2003 platform, Visio will prompt for the user to go to the Windows download page and download/install the XMLLite component, if it is not installed.? The side effect of not doing so will be poorer performance in XML operations.Additional ResourcesMSDN Office Developer Center - Visio 2010All things related to developing with Visio. As new material becomes available, it should be posted here.(office.14).aspxDesigning Shapes for use with Themes in Visio 2007Learn about the new Theme feature in Microsoft Office Visio 2007, how it works, and how it affects and improves your ability to design shapes. Center and Security SettingsAbout Security Settings and Running Code in Visio Notes for Microsoft Office Solution Developers, remove, or change a trusted location for your filesA trusted location is typically a folder on your hard disk or a network share. Any file that you put in a trusted location can be opened without being checked by the Trust Center security feature. This article explains why trusted locations can be useful and how you create them. It also outlines precautions that you should take before using a trusted location. of security in the 2007 Office systemAn organization's financial success often hinges on the productivity of its information workers and the integrity and confidentiality of its intellectual property. In the past, satisfying these business needs was difficult for IT professionals because protection often came at the expense of productivity. With a redesigned security model and many new and enhanced security features, the 2007 Microsoft Office system makes it possible for IT professionals to design desktop configurations that mitigate security threats while maintaining information worker productivity. trusted locations and trusted publishers settings in the 2007 Office system security settings for ActiveX controls, add-ins, and macros in the 2007 Office system Security Considerations for Office SolutionsThe security features provided by the Microsoft .NET Framework, Microsoft Office 2003, and the 2007 Microsoft Office system can help to protect against a variety of possible security threats in Visual Studio Tools for Office solutions. This topic provides recommendations to help you protect your Visual Studio Tools for Office solutions against possible threats, and also includes information about the behavior of Microsoft Office security settings on Visual Studio Tools for Office solutions.(vs.80).aspxXML for VisioOverview of DatadiagramMLVisio XML reference. DatadiagramML FilesCovers information on what happens to XML data when round tripping Visio files between Visio 2003 and Visio 2007. Elements in DatadiagramML in Microsoft Office Visio 2007 Custom XML in a DatadiagramML FileYou can include custom XML data specific to your solution within your DatadiagramML file, provided the data contains well-formed XML that complies with the DatadiagramML schema and the internal rules of Microsoft? Office Visio?. LiteThis documentation provides information about XmlLite, Microsoft's new XML parser. downloads for XML Lite for Windows XP (KB915865)Download for XML Lite for Windows XP Features ReviewQuestionsThere is no Theme object in the Visio object model. How are these stored?How do Color Schemes still work in Visio 2007?Where does the developer find the information for the currently applied theme? If a shape has a theme applied, but then is protected against further applications of a theme, how does the developer know which theme the shape gets its theme features from.Custom solutions may require the storing of data along with the Visio drawing. What mechanism is provide to store this data in XML form?What namespace is used in the Visio .vdx file when capturing cell values that are new to Visio 2007?AnswersNew or duplicated Themes are stored as Masters. The built-in themes are not in the object model. The Color Scheme add-on “CS” still exists. If a drawing was created in an earlier version of Visio using Color Schemes, that drawing has an Action cell that calls the “CS” add-on.In the page’s ShapeSheet in User.msvThemeColor and User.msvThemeEffect.The shape has user defined cells User.msvThemeColor and User.msvThemeEffect which may be different from those on the page’s ShapeSheet. Once the shape is protected against themes, these cells do not change.SolutionXMLThe vx namespace. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download