Author Topic: Reduce Number of Shapes in Org Chart  (Read 338 times)

0 Members and 1 Guest are viewing this topic.

KCinMelbourne

  • Newbie
  • *
  • Posts: 2
Reduce Number of Shapes in Org Chart
« on: August 05, 2018, 11:54:36 PM »
Hi all,

I'm new to Visio so please let me know if this question is unclear.

I'm building an org chart with the intent of carrying it across to PowerBI.  The org chart has less than 300 people so I expected would have only 300 shapes (double that if it includes the connectors). When I add the shapes to a layer though, it's telling me there are what equates to 10 shapes per resource. I have only been able to reduce the number of shapes by deleting the photo which makes it 9 shapes per resource.  As there is a limit of 1000 shapes in order to display a Visio diagram in PowerBI, this is a show stopper. 

Any advice on how to reduce the 'number of shapes' would be appreciated.

Thanks
KC
« Last Edit: August 06, 2018, 03:15:52 PM by KCinMelbourne »

Yacine

  • Hero Member
  • *****
  • Posts: 2510
Re: Reduce Number of Shapes in Org Chart
« Reply #1 on: August 06, 2018, 08:57:37 AM »
Even if you reduce each entity to 1 shape, you're - with 300 people - far over the limit of 100 shapes anyway.
So the task should rather be to increase the limit of 100, isn't it?
Yacine

KCinMelbourne

  • Newbie
  • *
  • Posts: 2
Re: Reduce Number of Shapes in Org Chart
« Reply #2 on: August 06, 2018, 03:16:34 PM »
Apologies, a typo. Permitted 1000 shapes.  I've now corrected.

Hey Ken

  • Full Member
  • ***
  • Posts: 173
  • Just This Guy
    • Ken Krawchuk, Libertarian for Pennsylvania Governor
Re: Reduce Number of Shapes in Org Chart
« Reply #3 on: August 07, 2018, 06:29:02 AM »
KC:

   Rather than a technical solution, how about a topology solution?  For example, you could break it up into several smaller ones, such as one per department, then string them all together once you get them into PowerBI.  I did something similar when I ran into the Visio limit for a drawing size by breaking it up into manageable pieces.  A pain, but better than nothing.

   Good luck!

   - Ken
Ken V. Krawchuk
Libertarian for Pennsylvania Governor (retired)
KenK4Pa.com

Yacine

  • Hero Member
  • *****
  • Posts: 2510
Re: Reduce Number of Shapes in Org Chart
« Reply #4 on: August 08, 2018, 03:16:04 AM »
For the sole purpose of exporting the data, you can replace the shapes by simpler ones by means of a macro.
Code: [Select]
Sub replaceShapes()

    Dim shp As Shape
    Dim sel As Selection
   
    Application.ActiveDocument.SaveAsEx "C:\Temp\Temp.vsd", visSaveAsWS + visSaveAsListInMRU
    openBlocksStencil
   
    ActiveWindow.SelectAll
    Set sel = ActiveWindow.Selection
   
    For i = sel.Count To 1 Step -1
        Set shp = sel(i)
        Debug.Print shp.ID
        If shp.CellExistsU("user.msvReplaceClass", visExistsAnywhere) Then
            shp.Cells("user.msvReplaceClass").FormulaU = Chr(34) & Chr(34)
            shp.ReplaceShape Application.Documents.Item("BLOCK_M.VSSX").Masters.ItemU("Box")
           
        End If
    Next i

End Sub

Sub openBlocksStencil()
    On Error Resume Next
    Application.Documents.OpenEx "block_m.vssx", visOpenRO + visOpenDocked
End Sub

I made sure to save the current file as temporary in c:\temp. You may want to put more safety in that line of code.
The macro needed to make sure that the organigram shapes can be replaced by ones not belonging to the special addin. That are the lines with "msvReplaceClass".
The result is a drawing where every organigram entity gets replaced by a simple rectangle. The new rectangles get the shape data of the original shape ... as long as they have a value!
The replacement removed somehow the connectors. I don't know if you need them in the other app. You could either code the dependencies in an extra field, or handle by yourselves (code) the connectors.

HTH,
Y.
PS: instead of replacing the shapes, you can also delete all the sub-shapes. eg: for each subShp in shp.shapes / subshp.delete
« Last Edit: August 08, 2018, 01:00:11 PM by Yacine »
Yacine