您如何判断文本是否适合其边界形状? [英] How do you tell whether text fits within its bounding shape?

查看:37
本文介绍了您如何判断文本是否适合其边界形状?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用占位符形状和应用程序脚本将数据从Google电子表格合并到幻灯片演示文稿,类似于.即使现在包含"并保持不变,这也不会改变.在幻灯片上覆盖更大高度的文本.我似乎无法获得实际文本的高度.

有什么方法可以说明

从2021年1月开始,您可以在Google幻灯片编辑器中设置自动调整设置.

点击内部形状时,您会看到新的自动拟合设置,将其设置为"请勿自动拟合"默认:

您可以将其更改为"溢出时缩小文本":

或另一种选择:"调整形状以适合文本大小":

P.S.目前似乎没有针对此新选项的Apps脚本更改.

I am doing a merge of data from a google spreadsheet to a slides presentation using placeholder shapes and apps script, something along the lines of this example.

I have the merge working well. The first issue I am having though is that the text is not bound by the shape that contains it. If the text does not fit within the bounding shape it simply overflows:

That wouldn't be such a problem if I could then somehow tell programmatically that the text has overflowed. As far as I can tell though I can only get the height of the bounding shape. Which doesn't change even though it now "contains" text that covers a much greater height on the slide. I don't seem to be able to get the height of the actual text.

Is there any way to tell what the height of the textrange is, or that it has overflowed, so that I can then either adjust some feature of the text (the font size, or the length of the actual text, etc) so that the text is bound by the textbox? Or at least alert the user that the text has overflowed.

The PowerPoint equivalent of this would be textrange.boundheight if that helps describe the property I am looking for, with a similar property I would then hopefully be able to implement something similar to the AutoSize feature.

The merge of text to a slide without some way to fit the text to the placeholder shapes doesn't seem that useful to me.

解决方案

As of January 2021, you can set auto fit setting in Google Slides editor.

When you click inside shape, you can see new Auto-fit setting, set to "Do not autofit" by default:

You can change it to "Shrink text on overflow":

Or another option: "Resize shape to fit text":

P.S. there seems no Apps Script changes available for this new option at the moment.

这篇关于您如何判断文本是否适合其边界形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆