Visio Guy

Visio Discussions => General Visio => Topic started by: UKpat on August 12, 2017, 04:04:33 AM

Title: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 04:04:33 AM
Hi guys

I'd like to create user story maps in Visio and capture the info entered into each shape in an Excel table.

For reference storymaps look like this:

(https://thumb.ibb.co/d3aNga/User_Story_Map.png) (https://ibb.co/d3aNga)

So far I've sussed getting the data into Excel, but I haven't figured out how to make shapes act like post-it notes...

While I could use some cloud based SaaS apps like www.StoriesOnBoard.com or www.Featuremap.com, I'd prefer to use the tools I already have to keep my monthly costs down and to be able to work offline when doing client sessions in public venues.

--

The Problem:

In many apps, if too much text is pasted into a shape / container, the extra text is simply hidden from view outside the boundary of the shape. In CSS this is called overflow, and the overflow can be set to :hidden:. In Excel, I think it happens whenever wordwrap is switched off (the default behaviour).

In Visio 2010 (which I'm using), the default behaviour seems to be that overflow text remains visible. (See: 'Default' in the image below).

Is there a way to hide any extra text which cannot fit into the shape?

(https://thumb.ibb.co/bS167F/Visio_shape_text_overflow.png) (https://ibb.co/bS167F)

Note: I don't want to resize the text inside the shape, nor do I seek to resize the shape to fit around the text.

So far I've spent a few hours Googling for a solution to no avail.


Things I've Tried:

I've explored all the ribbon tabs and right-click menus for toggles and combed through the options menu but didn't see anything.

I looked at the shape's shapesheet but couldn't find anything either. (The closest thing I could find was 'Misc. HideText')

Do you have any good ideas about how to make this happen?


Any help on how to do this is appreciated!

Best regards,

Patrick
Title: Re: How to set a shape's text overflow property to :hidden:?
Post by: wapperdude on August 12, 2017, 05:30:59 AM
Not aware of any setting in Visio for this desired behavior.  Nor have I seen any macros/code that addresses this problem.

Somehow you need to count number of line feeds, then best on font size plus line spacing, etc., calculate when the text overall as the containing g shape.

Wapperdude
Title: Re: How to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 09:19:04 AM
Nice challenge...
Here is a lazy solution:
Truncate as much letters from the original text as to get a ratio equal to shape.height / textHeight.
So the text to display would be: LEFT(ShapeText(TheText), INT(Len(ShapeText(TheText)*Height/TextHeight(TheText,Width)))

And as you cannot modify directly the display of the text, I hid the actual text and set its value to display in a sub-shape. This way you can edit the text by hitting F2, but the display text is processed before display.

As this method is lazy - without correct calculation of the line breaks - the result may fall on the lower edge of the shape. To correct this deviation I added a control point which sets a correction factor to the number of characters to truncate.

And last but not least, I added a continuation sign ( " ... " ) to the text whenever it gets truncated.

Note: I couldn't find a way to cut at the end of a word. The truncation will occur at any place and leave parts of words ... a question for my forum fellows.
Title: Re: How to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 11:03:22 AM
Hi guys

Thank you Wapperdude and Yacine for responding.

@Yacine

Where do I enter the formula you suggest?

I'm new to shapesheets and formulas.

Patrick :)
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 05:37:16 PM
Check the uploaded attachment.
Set Visio in Developer mode.
Right Click on shape, then open shapesheet.
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 07:11:57 PM
Quote from: Yacine on August 12, 2017, 05:37:16 PM
Check the uploaded attachment.
Set Visio in Developer mode.
Right Click on shape, then open shapesheet.

I didn't see the attachment the first time I read your post, but I see it now.

Checking out what you've shared, what you've created works like a charm!

Thank you Yacine! :)

-----------------

Looking at the shape sheet, I'm still lost as to what you've actually done. Clicking on all the editable regions, I don't see your formula anywhere. Does that mean that different parts of the formula are in different boxes?

As I said, I'm new to the shapesheet, so I'm still unsure what the workflow is beyond simply changing one box at a time to do simple alterations.

I really appreciate your help.

Patrick :)

Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 07:28:26 PM
Hi Yacine

Just trying to export a long bit of text entered into one of the boxes. It seems that not all of the text entered into the Visio shape gets exported.

Do you think that's some function of the truncation in your formula?

Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 07:58:28 PM
Hello Patrick,
a try to explain the process by a picture...
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 07:59:17 PM
Quote from: UKpat on August 12, 2017, 07:28:26 PM
Hi Yacine

Just trying to export a long bit of text entered into one of the boxes. It seems that not all of the text entered into the Visio shape gets exported.

Do you think that's some function of the truncation in your formula?


How long is the text? can you put it in your reply? ... or even better can you upload your drawing?
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 08:24:39 PM
Quote from: Yacine on August 12, 2017, 07:58:28 PM
Hello Patrick,
a try to explain the process by a picture...

That's awesome Yacine, it makes a lot more sense seeing it now. :)

I saw from the exported data that there were extra (empty) shapes, although I didn't notice the grouping in Visio.

After ungrouping the group, I can see the formulas / fields you've put into the user defined cells.

There's no way I would have figured out all of this by myself!

I take it you've been programming + using Visio professionally for many years? :)


Quote from: Yacine on August 12, 2017, 07:59:17 PM
Quote from: UKpat on August 12, 2017, 07:28:26 PM
Hi Yacine

Just trying to export a long bit of text entered into one of the boxes. It seems that not all of the text entered into the Visio shape gets exported.

Do you think that's some function of the truncation in your formula?


How long is the text? can you put it in your reply?


Here's a picture of the two boxes

(http://thumb.ibb.co/fWgeUv/Exported_Text.png) (http://ibb.co/fWgeUv)

In the left hand box is the original text left untouched. In the right hand box, I've pasted the text that was exported into Excel.

I've pasted the actual text below.

Original text:

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?

Exported Text

But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human h
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 08:33:45 PM
.
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 08:42:28 PM
Hi Yacine

I did try as you suggest, moving the yellow handle to different points to check whether it was effecting the data export. It didn't seem to have any effect, at least on my computer.

I tried extending it way below the end of the text, so that all the text was clearly visible with plenty of extra space beneath.

I also tried moving it up above the text so that all the text was visible again, and there was no truncation.

:)
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: Yacine on August 12, 2017, 08:46:55 PM
Glad I could help. Enjoyed the challenge.
Title: Re: How can I to set a shape's text overflow property to :hidden:?
Post by: UKpat on August 12, 2017, 08:50:38 PM
Thank you again! :)

Here's the template I've made using the shape you created.