Cannot control font when using OrgCWiz addon

T

tiberio

Hi everybody,
I have a visual basic program that creates Orgcharts from an ODBC database.
It works fine.
I would like to my program to change the font for the orgchart, same as
doing a
Organizational Chart -> Options -> Text , but I cannot find a way to to
control the addon via Visual Basic, other than the initial creation of the
chart.

Just changing the font of the each and every shape is not the same thing.
The text in the orgchart boxes is over multiple lines and by using the addon
menu, you can control each and every one separately.

Any help would be very much appreciated !!!
 
J

John Goldsmith \(Visio MVP\)

Hello Tiberio,

Although you can access some of the Org Chart addon functionality
programatically, I don't think you can with the text function. However, by
the look of it all the addon is doing is iterating through the shapes and
changing the respective shapesheet cells (it doesn't appear to effect the
masters).

So have a look over here for looping through the shapes:

http://visualsignals.typepad.co.uk/vislog/2007/11/looping-through.html

....then, check whether the shape is of the correct type, by checking it's
master name (shp.Master.NameU) . If it is an Executive / Manager /Position
etc. based shape then make the changes you want to the Character section of
the shapesheet.

For basic Org Chart shapes the Character section contains four rows (one for
each custom property). If you have a play around and use the Organizational
Chart / Options / Text dialog, while keeping an eye on the shapesheet,
you'll see which row relates to which text block. You can then change the
cells something like this (assumes you've already got a reference to the
correct shape 'shp'):

With shp
'change the font size for each row
..CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 1, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 2, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 3, visCharacterSize).FormulaU = 20pt
'change the font colour for the second row
..CellsSRC(visSectionCharacter, 1, visCharacterColor).FormulaU = RGB(200, 50,
50)
End With

You can see that the CellsSRC property of a shape object takes three
arguements: Section, Row and Column and you can either use numbers (of type
Integer) or the equivilent Visio enumerations.

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 
T

tiberio

Thank you, you rock !
Best regards
Tiberio

John Goldsmith (Visio MVP) said:
Hello Tiberio,

Although you can access some of the Org Chart addon functionality
programatically, I don't think you can with the text function. However, by
the look of it all the addon is doing is iterating through the shapes and
changing the respective shapesheet cells (it doesn't appear to effect the
masters).

So have a look over here for looping through the shapes:

http://visualsignals.typepad.co.uk/vislog/2007/11/looping-through.html

....then, check whether the shape is of the correct type, by checking it's
master name (shp.Master.NameU) . If it is an Executive / Manager /Position
etc. based shape then make the changes you want to the Character section of
the shapesheet.

For basic Org Chart shapes the Character section contains four rows (one for
each custom property). If you have a play around and use the Organizational
Chart / Options / Text dialog, while keeping an eye on the shapesheet,
you'll see which row relates to which text block. You can then change the
cells something like this (assumes you've already got a reference to the
correct shape 'shp'):

With shp
'change the font size for each row
..CellsSRC(visSectionCharacter, 0, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 1, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 2, visCharacterSize).FormulaU = 20pt
..CellsSRC(visSectionCharacter, 3, visCharacterSize).FormulaU = 20pt
'change the font colour for the second row
..CellsSRC(visSectionCharacter, 1, visCharacterColor).FormulaU = RGB(200, 50,
50)
End With

You can see that the CellsSRC property of a shape object takes three
arguements: Section, Row and Column and you can either use numbers (of type
Integer) or the equivilent Visio enumerations.

Hope that helps.

Best regards

John


John Goldsmith (Visio MVP)
www.visualSignals.typepad.co.uk
www.visualSignals.co.uk
 

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