Skip to content
本页内容

TextFrame2 (属性)

返回一个 TextFrame2 对象,该对象包含指定形状的文本格式。只读。

示例

python
#本示例向活动工作表中添加一个矩形,向矩形中添加文本,然后设置文本框的边距
def test():
    textFrame2 = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 0, 0, 250, 140).TextFrame2
    textFrame2.TextRange.Text = "Here is some test text"
    textFrame2.MarginBottom = 10
    textFrame2.MarginLeft = 10
    textFrame2.MarginRight = 10
    textFrame2.MarginTop = 10
python
#本示例将第一张工作表中第一个形状的文本框内字号设置为22
def test():
    shape = Application.Worksheets.Item(1).Shapes.Item(1)
    shape.TextFrame2.TextRange.Font.Size = 22