none
Visio 2010 AddIn development: How can I use/trigger the feature "Re-Layout Page" programmatically developing an AddIn for Visio ? RRS feed

  • Question

  • Using the regular user interface of Visio, I can use the "Re-Layout Page" feature for reorganizing a chart with connected shapes (as discussed here: http://blogs.msdn.com/b/visio/archive/2009/08/18/layout-improvements-in-visio-2010.aspx). Unfortunately, I'm unable to find an object or a method or any hints to that feature in the API of Visio.

    Can anyone help with that ?

    Thanks in advance,

    Hendrik

    Thursday, January 5, 2012 4:45 PM

Answers

  • Thanks for your advice. I used the macro recorder to bring out the following solution:

     

    ActiveWindow.Page.PageSheet.CellsSRC(

    VisSectionIndices.visSectionObject, VisRowIndices.visRowPageLayout, VisCellIndices.visPLOPlaceStyle).FormulaForceU = intPlaceStyle

     

    ActiveWindow.Page.PageSheet.CellsSRC(

    VisSectionIndices.visSectionObject, VisRowIndices.visRowPageLayout, VisCellIndices.visPLORouteStyle).FormulaForceU = intRouteStyle

     

    ActiveWindow.Page.Layout()

     

    Hierarchical shapes widen out from left to right:

    intPlaceStyle = 23

    intRouteStyle = 4

    Hierarchical shapes widen out from top to bottom:

    intPlaceStyle = 17

    intRouteStyle = 3

     

    I don't know if these numerical values refer to any enumeration but I have found those values here:

    http://msdn.microsoft.com/en-us/library/ms406457%28v=office.12%29.aspx

    http://msdn.microsoft.com/en-us/library/ms406474%28v=office.12%29.aspx

    Friday, January 6, 2012 1:10 PM

All replies

  • The shortcut for these kinds of challenges is the Macro recorder in Visio. Use it to record what is happening and then just port the vba over to your .Net project.

    hth,

    Al


    If this answer solves your problem, please check Mark as Answered. If this answer helps, please click the Vote as Helpful button. Al Edlund Visio MVP
    • Proposed as answer by Bruce Song Monday, January 9, 2012 7:13 AM
    Thursday, January 5, 2012 5:45 PM
  • Thanks for your advice. I used the macro recorder to bring out the following solution:

     

    ActiveWindow.Page.PageSheet.CellsSRC(

    VisSectionIndices.visSectionObject, VisRowIndices.visRowPageLayout, VisCellIndices.visPLOPlaceStyle).FormulaForceU = intPlaceStyle

     

    ActiveWindow.Page.PageSheet.CellsSRC(

    VisSectionIndices.visSectionObject, VisRowIndices.visRowPageLayout, VisCellIndices.visPLORouteStyle).FormulaForceU = intRouteStyle

     

    ActiveWindow.Page.Layout()

     

    Hierarchical shapes widen out from left to right:

    intPlaceStyle = 23

    intRouteStyle = 4

    Hierarchical shapes widen out from top to bottom:

    intPlaceStyle = 17

    intRouteStyle = 3

     

    I don't know if these numerical values refer to any enumeration but I have found those values here:

    http://msdn.microsoft.com/en-us/library/ms406457%28v=office.12%29.aspx

    http://msdn.microsoft.com/en-us/library/ms406474%28v=office.12%29.aspx

    Friday, January 6, 2012 1:10 PM