Home > Net >  Replaceshape: I want to enable ReplaceLockText in the replaceshape of all grouped objects
Replaceshape: I want to enable ReplaceLockText in the replaceshape of all grouped objects

Time:04-08

I'm applying the replaceshape method to 3 or more grouped VISIO objects. I thought that by setting the ReplaceLockText option to 0, all the text information of the old object could be inherited, but it doesn't work.

After investigating the cause, we found that if there are more than one object in which you can enter text, the text of the foreground object is preserved, but the rest of the text is not preserved. This bug occurs even if replacelocktext is set to 0 or the option of the Replaceshape method is set to 1.

enter image description here

    Set vsoShape = vsoShape.ReplaceShape(vssxMasters.Item(MasterName), 0)

The replaceshape method works fine, except that some text is discarded.

How can I replaceshape while preserving all the text?

The master shape has 3 or 4 child objects.

All protection is 0. Such as LockTextEdit

<Chiled object 1> It is an object that has nothing to do with this issue.

LockTextEdit = 1. I allow the value to be selected from a list of PHASE, SUBROUTINE, etc. The list is stored in Shape Data's Format, and which one is selected is stored in Shape Data's Value.

<Chiled object 2> An object that holds text in the replaceshape method. LockTextEdit is 0. Also, ReplaceLockShapeData, ReplaceLockText, and ReplaceLockFormat are 0.

It is the object located in the foreground of the figure. It is also an object that can be edited when the F2 key is pressed.

<Chiled object 3> It is an object whose text is not retained by the replaceshape method, which is the object in question this time. Similarly, LockTextEdit is 0. Also, ReplaceLockShapeData, ReplaceLockText, and ReplaceLockFormat are 0.

It is an object located in the middle of the figure. TextEdit is possible, but if you type after clicking the parent object, Object1 takes precedence.

When the ReplaceShape method is executed, the text data disappears and is rewritten to the master data.

The string "test1" is not inherited.

enter image description here

CodePudding user response:

Please try use flag visReplaceShapeLockText Read more about ReplaceShape method

CodePudding user response:

I experimented a bit with the ReplaceLockText option. It seems to work only with simple shapes (which don't contain sub-shapes)!
[enter image description here]

  • Related