I have some code which creates potentially lots of shapes and sets shape data to various values. Some shapes might have 5 shape data rows, and some 20 (or various other values).
This is written in VB.Net and I would like to improve performance. Following guidelines here:
http://blogs.msdn.com/b/mailant/archive/2004/09/22/233082.aspx
I have been looking at calls to .DropMany and .SetFormulas.
One issue is that I want to add lots of Shape Data rows - while there exists an .AddShapes call to do multiple rows in one hit, there is no equivalent for shape data section - leaving multiple calls to .AddNamedRow (I have tried calls to AddRows but it gives an error when used with Shape Data section).
Current algorithm:
Work out which masters to use for which shapes (not all the same)
pg.DropMany(with array of masters and appriate X/Y coords)
for each shape dropped:
for each shape data row (e.g. 5 - 10 times per shape):
shp.AddNamedRow()
pg.SetFormulas(for all shapes on page and all properties)
Any other suggestions for improving performance?
One thing you might try is to use the ScreenUpdating property on the Visio application object. When set to False, Visio will not update its window until the property is set to True again. I've not used Visio automation before but I have used this with Word and it helps a lot. The trick is to find a good trade-off between speed and frequency of updates-- if you turn off updating for too long, the user might think Visio has crashed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With