get text from shapes

Started by nupurr, March 14, 2013, 09:51:52 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nupurr

i need to get text from shapes in the order that they are displayed on the visio page. i can get it normally. but when i change the order of shapes then the text order doesnt change. it still gives me the old order of shapes and data.! can u pls help me out?

Paul Herber

What do you mean by the order? Ordered by the time they were put on the page, left to right, right to left, down the page, up the page, or what?
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

nupurr

they are getting ordered as per the time they are been put on the page.
where as i want them ordered top to bottom.

Paul Herber

#3
That (ordered by time placed on page) is the natural order, the indexes within Visio will use this.
Any other order will have to be handled by code of some sort.
I'd suggest creating an array containing the shape index, X and Y coordinates (but more on that in a minute). Sort the array on the X and Y coordinates, then use the sorted indexes to retrieve the text.

The shape X and Y coordinates are usually the coordinates of the shape's centre point, you probably want the top left hand corner (not guaranteed as some locales will want right to left and/or botton to top). To get this you will also need to use the shape LocPinX/LocPinY and Width and Height cells.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

vojo

hang on Paul.....I vaguely recall some verbiage along the lines that visio will walk thru shapes and cells pretty randomly (or at least inconsistently)
I think I saw it as part of the doc for SETF where it says one should use GETREF(cell) vs "cell" because the visio database will reorganize entries as needed.  Also, if really predictably linear, I would think there would be no use for DEPENDSON since this given cell would ALWAYS be triggered by the other cell in a deterministic fashion and visio would have to do multiple passes thru the DB to catch all of a chain reaction anyway.

I guess my point is this:  If the shape/cell database is rearranged, for various reasons, I dont think you can count the 1st shape sought is the first shape laid down in the drawing

Tune me up if I am off base here.

Paul Herber

Sorry Vojo, I haven't the faintest idea what you are talking about!
I don't know what you mean by walking through the shapes. My code iterates through them always in a 100% deterministic manner.
SETF? DEPENDSON?
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/

vojo

ok....here is a specific example

- make a rectangle
- insert ==> formula ==>object properities ==> name
- copy the shape 3 times

Now you have sheet.1, sheet.2, sheet.3, sheet 4

- delete first shape....sheet.1
- add a new shape....guess what, its called sheet.1

So the numerical first shape is actually the fifth shape placed on the drawing.

So assuming uses a predetermined algorithm for walking thru shapes
   - If numerical, sheet.1, sheet.2, sheet.3, sheet.4 
   - If by precedence,  sheet.2, sheet.3, sheet.4, sheet.1

SETF says that quotes should not be used because it makes placing the shape in different drawings a problem.

Paul Herber

Yes, but that's the ID, not the index.
Electronic and Electrical engineering, business and software stencils for Visio -

https://www.paulherber.co.uk/