Converting text box to EMF picture and Cropping problem

Started by diracsbracket, June 04, 2018, 04:42:23 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

diracsbracket

Hi
I use Visio to create PNG image files for button icons etc. which must fit exactly in my
defined size, e.g. 64x64 pixels.

When the shape contains a textbox however, no matter how I initially size the
text box frame to exactly contain the text (and the reference shape size), the produced PNG will always include
empty margins due to the text. Those png icons are therefore not conforming to the reference size,
since the content is smaller due to these empty margins.

This behavior is easily reproduced by copy/pasting an exactly dimensioned textbox as picture
inside the visio page itself: it will result in an image with large margins around the text...

I tried setting all the text box settings relating to such a margin to 0, but to no avail. After
the conversion to image, these margins always are present.

As a result, for shapes containing text, I am forced to:
1. Convert the text to image
2. Crop the text image manually to remove those unwanted margins
3. Export the composite shape + text image to my final .png file.

What a mess!

Of course, I am doing the conversion from text to EMF and the export to PNG via VBA,
but I couldn't find a way to crop the text image via VBA. For example, the macro recorder
does not show that part (only the undo framework part of the crop).

I've seen references to "Foreign data" info for pictures in the Shapesheet, but this is not available
in Visio 2013 ?

How can I solve this?
Thanks in advance for any suggestions you may have!


Paul Herber

Is it the text or just the box that is causing this? There is nothing special about text boxes. Try a standard rectangle shape from the drawing ribbon, then set the line to "none. Don't add text. See if that works.
I suspect it is the EMF export that is the problem.
Electronic and Electrical engineering, business and software stencils for Visio -

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

diracsbracket

It also happens when I don't use a text box, but e.g.use a rectangle object from the ribbon which I double-click to add text to it.
You can easily try yourself: just create a text object, then copy/paste as image (Image, EMF or bitmap): the margins are automatically added...