I hate to post questions, but I am stumped here.
The CIMParagraphTextGraphic should have a way to tell whether or not the word wrapping made text go outside of the boundaries of the shape somehow. Is there some object I am missing that can do this?
In the layout, without using code, there it detects is there is not enough room, and shows this underneath it: [...]. Any thoughts on how I can detect that this happened?
Thank you
Solved! Go to Solution.
Jeremy, have you tried Element.DoesFitFrame?
string text = "Some Text String that is really long and is forced to wrap to other lines so that we can see the effects. Some Text String that is really long and is forced to wrap to other lines so that we can see the effects." as String;
GraphicElement recTxtElm = LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement(layout, env, text, sym);
recTxtElm.SetName("New Rectangle Text");
TextElement txtElm = recTxtElm as TextElement;
while (!txtElm.DoesFitFrame)
{
var txtProp = txtElm.TextProperties;
txtProp.FontSize = txtProp.FontSize - 1;
txtElm.SetTextProperties(txtProp);
System.Windows.MessageBox.Show(txtProp.FontSize.ToString());
};
Thank you Jeff,
I can't believe I missed that before.
I do want to modify the original polygon instead of reducing the font size. Same concept.
Much appreciated.
Jeremy, have you tried Element.DoesFitFrame?
string text = "Some Text String that is really long and is forced to wrap to other lines so that we can see the effects. Some Text String that is really long and is forced to wrap to other lines so that we can see the effects." as String;
GraphicElement recTxtElm = LayoutElementFactory.Instance.CreateRectangleParagraphGraphicElement(layout, env, text, sym);
recTxtElm.SetName("New Rectangle Text");
TextElement txtElm = recTxtElm as TextElement;
while (!txtElm.DoesFitFrame)
{
var txtProp = txtElm.TextProperties;
txtProp.FontSize = txtProp.FontSize - 1;
txtElm.SetTextProperties(txtProp);
System.Windows.MessageBox.Show(txtProp.FontSize.ToString());
};
Thank you Jeff,
I can't believe I missed that before.
I do want to modify the original polygon instead of reducing the font size. Same concept.
Much appreciated.
Jeremy,
We also have future plans to introduce a "fitting strategy" with polygon text (similar to legends). The easiest and minimum ship optoin is:"Adjust font size" (with a minimum font size property). We could also consider things like "adjust polygon width / height / or both" and growth would be based on anchor position.
Jeff - Layout and arcpy.mp teams
It is funny you mention that. I can do that now, to my surprise, if you are using the polygon text, it will not change the font size I made a small add-in to test that since I could already do it inside of a layout. I click a button to add the paragraph text, then a button to change the width. The height, font size, etc., stay the same size. Only difference is the bottom two points on the polygons need to stay at their original locations.
In ArcObjects, you could use ITransform2D.Scale to do the trick. I am improvising.
That would actually be a lot better, using the anchor positions. I drop text at equal intervals a lot. If the the text size is too large, there is nothing that the will to change that. It was a user setting.