Organization Chart : Prop.ChildLayoutStyle no longer exists in Viz

W

Wayne Birch

Hello everyone,

Ive got this solution written in VB6 that uses the Visio API to create
organization charts programmtically. I didn't write it actually, another
developer who has now left wrote it. I've got one problem left to solve -
getting the page size to fit the chart. Some of the charts are larger than
the page size so when they get exported they get shrunk to unreadable sizes.
After much investigation I discovered the ResizeToFitContents method of the
Page object. Trouble is it doesn't work in Visio 2000, which is what the
solution was developed for. After further investigation I have discovered
that it works in Visio 2003. So, gleefully upgraded to Visio 2003 only to
find that the solution no longer works.

The troublesome lines of code are attempts to set ShapeSheet properties of
shapes drawn onto the page, namely: -

Prop.ChildLayoutStyle
User.AL_Justification
User.AL_JustOffset
User.AL_cyBtwnSubs
User.AL_cxBtwnSubs

After much investigation (again) I have discovered that these properties no
longer exist in the organization chart template in Visio 2003. I have
determind that first one is being used to adjust the way child subordinates
are laid out (equivalent to clicking on Arrange Subordinates in the
interface).

So, my questions are: -

1) Where did these properties disappear to in the Visio 2003 Organization
Chart Template and why?
2) Is there another way of achieving the same thing in Visio 2003?

I've tried lots of things to get round this including trying to use the
Visio 2000 Organization Chart Template with Visio 2003 (that comes with it's
own set of problems which really aren't worth the effort to solve, if they
are solvable at all).

Any help would be gratefully appreciated because a lot of effort was put in
to get this far and if I can't solve this then the project will be scrapped,
which is the last thing I want.

TIA,
Wayne
 
W

Wayne Birch

Thanks for the reply John - but do you know the answer to the question about
automating the arranging of subordinates for a given shape? ta.
 
M

Mark Nelson [MS]

I wasn't able to track what you already figured out and what you still need
to figure out below. Can you summarize please?

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John Marshall, MVP

The cells you mention relate to fine tuning the positioning and layout of
shapes. You should be able to comment out any reference to these cells and
continue. The results may not be the same as with the older version, but it
should do the job.

John... Visio MVP

Need stencils or ideas? http://www.mvps.org/visio/3rdparty.htm
Need VBA examples? http://www.mvps.org/visio/VBA.htm
Common Visio Questions http://www.mvps.org/visio/common_questions.htm
Visio Wishlist http://www.mvps.org/visio/wish_list.htm
 
W

Wayne Birch

Hi John - I did do that (i.e. rem out the offending lines) and it did indeed
work ok. Well, I say work ok, it didn't error out, but the lining up is now
not working as a result. I really do need to get the same results as I was
getting with Visio 2000 otherwise the charts look rubbish. Thanks.
 
W

Wayne Birch

Hi Mark,

The code was written to work with Visio 2000 and the most important part of
the code is the setting of the Cells("Prop.ChildLayoutStyle") to the value of
1. This has the same effect as manually clicking on 'Arrange Subordinates'
and selecting the arrangement where the children are vertically beneath the
given shape rather than horizontal. There are four other custom cell
properties set in the code (User.AL_Justification, User.AL_JustOffset,
User.AL_cyBtwnSubs, User.AL_cxBtwnSubs) but I haven't figured out what these
do yet other than they help layout the subordinates of a given shape. Seeing
as none of them work because they no longer exist in the Visio 2003 Org Chart
Template I was just dealing with them one at a time, the most important
appearing to be the Prop.ChildLayoutStyle property.

Just to clarify, here's how the program code attempts to use these
properies: -

shape.Cells("Prop.ChildLayoutStyle") = 1

where shape is an object reference to a shape that has been dropped on the
page.

Thanks.
 
W

Wayne Birch

Hi again - just in case I didn't quite answer your question correctly, what
I'm trying to achieve is

either

How can I resize the page to fit the size of the drawing in Visio 2000?
Programmitcally of course. Visio 2003 has the ResizeToFitContents method but
Visio 2000 doesn't, despite it being on the Print dialog in Visio 2000

- or -

How can I programmatically call the 'Arrange Subordinates' feature of the
organization chart in Visio 2003. In visio 2000 the program was using
shape.Cells("ChildLayoutStyle") = n but this custom property no longer exists
in the Visio 2003 version of the organization chart template.

Thanks,
Wayne
 
M

Mark Nelson [MS]

I would think that you could write your own routine to resize the page to
fit contents. If you do a Select All and then get the Selection object, you
can use the BoundingBox method of the Selection to retrieve a rectangle
defining the contents of the page. Then you can change the PageWidth and
PageHeight cells in the PageSheet based on that rectangle (plus whatever
margin you choose).

I'm not sure that you can manipulate the Org Chart solution in Visio 2003
like you can in Visio 2000. If you look in the Actions section of an Org
Chart shape, you will see a number of RunAddon calls. However, the command
to Layout Subordinates brings up a dialog first. This may not be what you
want in code. You might be able to use Application.AlertResponse to prevent
the dialog from popping up, but then you will have to live with whatever its
default layout value is.

Sorry that I don't have more definitive answers. There is no quick solution
here.

--
Mark Nelson
Office Graphics - Visio
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
 
W

Wayne Birch

Thanks for the idea Mark - sounds like it will work and do just what I need.
I've got to get the server guys to roll back the server to Visio 2000 so that
I can code it and give it go - I'll let you know how I get on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top