形状不显示所有文本
Shape doesn't show all text
我需要创建标有数字的形状,但形状不显示整数。
例如,如果数字是 1 到 9,它会显示,但对于 10 到 19,它只显示 1。
我不想改变它必须相同的半径。
Sheets(xRiS).Select
Dim textRectangles As Shape
Dim radius As Integer
radius = 15
Set textRectangles = ActiveSheet.Shapes.AddShape(msoShapeOval, (Range("D13").Left - radius / 2), _
Range("D13").Top - radius / 2, radius, radius)
textRectangles.Name = "Groups " & i
textRectangles.TextFrame.Characters.Text = i
textRectangles.TextFrame.VerticalAlignment = xlVAlignCenter
textRectangles.TextFrame.HorizontalAlignment = xlHAlignCenter
textRectangles.TextFrame.Characters.Font.Size = 9
textRectangles.TextFrame.Characters.Font.Name = "Georgia"
textRectangles.Fill.ForeColor.RGB = RGB(220, 105, 0)
textRectangles.Fill.Transparency = 0.5
这是当前结果:
这是我想要的结果:
如何配置形状以显示数字为 10-19 的数字?
有几个理论上的选择,但似乎都不适用于 radius = 15
和 textRectangles.TextFrame.Characters.Font.Size = 9
。
首先是 textRectangles.TextFrame.AutoSize = True
,它会调整形状的大小以修复文本 - 但是,这将显着扩展 radius
。
第二个是 textRectangles.TextFrame2.AutoSize = msoAutoSizeTextToFitShape
- 但是,这仅在最小值为 radius = 33
时有效。
您可能需要考虑增加半径。
我需要创建标有数字的形状,但形状不显示整数。
例如,如果数字是 1 到 9,它会显示,但对于 10 到 19,它只显示 1。
我不想改变它必须相同的半径。
Sheets(xRiS).Select
Dim textRectangles As Shape
Dim radius As Integer
radius = 15
Set textRectangles = ActiveSheet.Shapes.AddShape(msoShapeOval, (Range("D13").Left - radius / 2), _
Range("D13").Top - radius / 2, radius, radius)
textRectangles.Name = "Groups " & i
textRectangles.TextFrame.Characters.Text = i
textRectangles.TextFrame.VerticalAlignment = xlVAlignCenter
textRectangles.TextFrame.HorizontalAlignment = xlHAlignCenter
textRectangles.TextFrame.Characters.Font.Size = 9
textRectangles.TextFrame.Characters.Font.Name = "Georgia"
textRectangles.Fill.ForeColor.RGB = RGB(220, 105, 0)
textRectangles.Fill.Transparency = 0.5
这是当前结果:
这是我想要的结果:
如何配置形状以显示数字为 10-19 的数字?
有几个理论上的选择,但似乎都不适用于 radius = 15
和 textRectangles.TextFrame.Characters.Font.Size = 9
。
首先是 textRectangles.TextFrame.AutoSize = True
,它会调整形状的大小以修复文本 - 但是,这将显着扩展 radius
。
第二个是 textRectangles.TextFrame2.AutoSize = msoAutoSizeTextToFitShape
- 但是,这仅在最小值为 radius = 33
时有效。
您可能需要考虑增加半径。