2013-02-09 47 views

回答

0

在VBA中,你會做這樣的事情來檢查子彈幻燈片1

Dim oSh As Shape 
Dim x As Long ' Integer in C#? 
For Each oSh In ActivePresentation.Slides(1).Shapes 
    With oSh 
     If .HasTextFrame Then 
      If .TextFrame.HasText Then 
       With .TextFrame2.TextRange 
        For x = 1 To .Paragraphs.Count 
         Debug.Print .Paragraphs(x).ParagraphFormat.Bullet.[Various properties] 

        Next 
       End With 
      End If 
     End If 
    End With 
Next 

看在PPT VBA編輯器的代碼。當您在上面的項目符號後鍵入點時,智能感知系統將顯示可用的屬性。

+0

感謝您的回覆。現在我會嘗試在c#中實現這一點。 – user2056958 2013-02-11 12:06:48

0

有幾種方法。在下面的代碼,你可以看到文本的屬性,你可以在你的程序中訪問:

ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.Type = 
    Office.MsoBulletType.msoBulletNumbered; 
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.Style = 
    Office.MsoNumberedBulletStyle.msoBulletAlphaLCParenBoth; 

ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.StartValue = 4; 
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.UseTextColor = 
    Office.MsoTriState.msoTrue; 
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.UseTextFont = 
    Office.MsoTriState.msoTrue; 

其中ppTextBox是一個圖形對象,並注意使用TextFrame2而非TextFrame的。您可以針對枚舉列表Office.MsoBulletType詢問ParagraphFormat.Bullt.Type以查看哪個已應用。

有關更多詳細信息,請查閱this page以瞭解有關使用C#在Powerpoint中處理文本的更多詳細信息。

+0

感謝您的幫助。它解決了我的問題。 – user2056958 2013-03-08 04:57:22

相關問題