News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Copying and Pasting (Inserted) Text Fields from Shapes

Started by JuneTheSecond, September 23, 2009, 12:11:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JuneTheSecond

Hi,

I have to modify a point about the matter of "Text Fields".

We cannot copy and paste the text fields data, only when the "text fields" refers to the "PinX",  "PinY", "BeginX", EndX, BeginY or "EndY".
We can copy and paste other text fields data such as "Width" and "Height".

But I wonder why the "Text Fields" is specified in such a manner. ??? ???


Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

Hi,

I've added Image and sample drawing for above post.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Paul Herber

But it does work if you just copy and paste without going via Notepad.
I would guess that the copied data is not a string and that it just evaluates to a "0" as text when pasted into a text editor.

Electronic and Electrical engineering, business and software stencils for Visio -

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

JuneTheSecond

#3
Hi,

Yes, you are right. :)
The evaluation is wrong in the case of PinX or PinY.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Paul Herber

It's interesting that if after doing the "copy" you look at what has been copied in the clipboard viewer then it shows exactly the results you see, i.e. copying from the PinY shape shows the copied text as 10.2646
Odd. Er, even more odd, now I try it and I just get "0"! Odd.

Electronic and Electrical engineering, business and software stencils for Visio -

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

JuneTheSecond

Hi,

Yes, really odd. Is it a bag in Visio, or any other reason?
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Paul Herber

I suspect there is something important in the copy data that we cannot see. The clipboard viewer is just doing its best and showing what it can see as text (which is also what appears in Notepad).

Electronic and Electrical engineering, business and software stencils for Visio -

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

JuneTheSecond

#7
Hi,

You cannot correctly copy and paste the displayed text fields that refer to "PinX" of the shape, but you can do correctly the text fields that refer to the "pinX" of other shape.(Image19.jpg and "Text Fields Oddness.")  :) :) ??? ??? ???

You can see the ClipBoards under the shapes in Image19.jpg.
The copied text from sheet.1 is not correct (left), but correct from sheet.2 (right). :) :)
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

#8
Hi,

Now, I got a trick that you can copy and paste correctly the displayed text fields on the shape. :) :) :)
If you wish to make copies of this shape, please duplicate the shape.
Please don't use document master. If this shape has the master, the trick does not work.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

#9
Hi,

If the row name of a user-defined cell is changed, the trick works when you drop the master.
Then I added a dummy row, and rename when you drop the master shape with VBA macro. :) :) :)
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Visio Guy

I use Visio 2007, U.S. English on Windows XP. A lot of you have "metric" versions of Visio, and I sometimes suspect there are problems with unit conversion, rounding, etc. since Visio works internally with inches. I don't think that's a problem here, though.

Anyway, the copying and pasting of these fields doesn't even work inside of Visio. You can copy the field-text from one of Junichi's shapes, then paste to the Visio page by having nothing selected, and using Paste Special.

Another weird thing I noticed is that with inserted fields, when you double-click a shape, or Ctrl+A select all text, you have an extra character on the end. You can't move the cursor to that last character though, only select all or double-clicking selects it.

Also interesting:

With an inserted field of PinX, which evaluates to "55", you'll get different string lengths, depending on how you query Visio:

?  len(Visio.ActiveWindow.Selection(1).Text)
   1

?  len(Visio.ActiveWindow.Selection(1).Characters.Text)
   2

Evidently inserted fields always have lengths of 1, so be sure to get text using shp.Characters.Text!
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

JuneTheSecond

#11
Hi,

Thank you, Chris.
I think you are right. :) :) :)
But in my try i think it is not the matter of units.
The same oddness is found in my Visio even if I create new drawing in inch-unit. (Image23.jpg)
The boxes at the right are Note Pads where the copied data are pasted.
This oddness appears for any selection manner.
1. Double click the shape and press Ctrl+C
2. Double click the shape, press Shift key, remove the last extra unseen character and press Ctrl+C.
3. Select shape simply and press Ctrl+C.


This oddness appears only when text field refers to the PinX, PinY or Beginx,,,,.
Now, I've come to think it is not a bug in Visio but a natural behavior, quite natural, but curious enough. :) :) :)

Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

#12
Hi,

By the way, all images attached here are copied with "Print Screen" button
on my keyboard, though trimmed with graphic software.
All fields-text that refer to PinX are correctly copied and pasted, however
copied as image but not as text.

It may be true that the any text-copy function outside Visio can copy those
text correctly. But I cannot find such a button on my keyboard that copies
only text from outside Visio. :) :) :)
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

#13
Hi,

If you copy the shape and paste it with the menu "Paste Special as EMF", the fields text that refer to PinX is not correctly pasted.(Image24.jpg) >:( >:( >:(
The value 17.7646 on pasted shape is Width(of sheet.1)*0.5+0.2646(constant). ::)

But if you save the shape as EMF and import it with menu "Import Picture", then the fields text is correct. :) :) :)
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

#14
Hi,

Now, I found the reason of "0.2646". :) :) :)
You can open the shape window and open Document Stencil,
and drag and drop the shape that has inserted text field from drawing to the document stencil.(Master.2)
Or you can copy the shape on the drawing and paste it to the document stencil.(Master.3)

Now, here are 2 masters.
I found 2 masters have different page size, page width and page hight.

You open the drawing window of the master, double clicking the master icon of Master.2.
If you move the master shape slightly, you can find the page of the master.
The size of the page is just the same as the master shape.

But the page size is larger than the master, if you open the Master.3. (Image25.jpg)
Page width and height are larger than the width of master shape by 0.5292 mm.
0.5292 mm = 0.2646 mm x 2
The Master.3 is on the center of the page larger than the master shape by 0.5292 mm.
Therefore the PinX = Width*0.5 + 0.2646.

It may be sure that the copied shape in the clipbord has the margin of 0.2646 mm around the shape.
:) :) :) :) :)
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 401 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1281KB.
Tokens: post-login.
Cache hits: 13: 0.00105s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 15.

[Show Queries]