不确定这是否可以在没有字符迭代的情况下完成,但我知道这可以通过这种方式完成。创建一个接受两个TextRange
对象作为参数的子例程,然后您可以迭代每个字符。
调用它想:
CopyTextFormats slide3.Shapes(9).Table.Cell(1, 1).Shape.TextFrame.TextRange, _
slide3.Shapes(2).Table.Cell(1, 1).Shape.TextFrame.TextRange
这里是子程序:
Sub CopyTextFormats(tRange1 As TextRange, tRange2 As TextRange)
Dim i As Long
'## "copy" the plain text from one table cell to the other
tRange2 = tRange1
'## Iterate the characters, in order to "copy" specific formatting properties:
For i = 1 To tRange1.Characters.Count
tRange2.Characters(i, 1).Font.Superscript = tRange1.Characters(i, 1).Font.Superscript
'### You can use this for other properties that you want to copy, too:
'
'tRange2.Characters(i, 1).Font.Bold = tRange1.Characters(i, 1).Font.Bold
'tRange2.Characters(i, 1).Font.Underline = tRange1.Characters(i, 1).Font.Underline
'
'If you don't want to copy a property, just omit it from this function
Next
End Sub
我知道这如果您在TextRange的迭代人物来完成,并应用所需的源格式的方式。但我不确定这可以通过其他方式完成。 –