1
我使用Microsoft.Office.Interop.PowerPoint
從* .pptx演示文稿中替換每個幻燈片中的某個特定標記。替換PowerPoint中的一些文本
問題是,令牌所在的文本框中有不同格式的行(例如具有不同字體大小的行)。
我真的試圖通過這兩個
shape.TextFrame.TextRange.Text = strStartText + replacementString + strEndText;
和
shape.TextFrame.TextRange.Text =
shape.TextFrame.TextRange.Text.Replace(oldString, replacementString);
做替換,但它統一,從而破壞我的文本框的所有格式。 所有行和單詞現在具有相同的尺寸/顏色等。
有沒有解決方法?
謝謝!抱歉,offtop,但是你在這裏使用的語法是什麼? – wh1t3cat1k
VBA。對不起,忘了提及你必須翻譯成.NETness,沿着... = shape.TextFrame.TextRange.Replace(oldString,replacementString);在這種情況下,TextRange.Replace是一種方法;它直接替換對象,不像.Text.Replace,它會返回一個字符串,但不會影響.TextRange.Text –
在PowerPoint中爲我工作 – Cocowalla