我正在使用Microsoft Office Interope程序集從.pptx和.ppt文件中使用c#提取功能。我能夠提取有關形狀,動畫的細節,但無法提取有關哪些類型的子彈ppt或pptx包含或哪些幻燈片包含子彈等詳細信息。如何使用c#從.pptx或.ppt文件中提取列表或項目符號細節#
請幫我找到它。 在此先感謝。
我正在使用Microsoft Office Interope程序集從.pptx和.ppt文件中使用c#提取功能。我能夠提取有關形狀,動畫的細節,但無法提取有關哪些類型的子彈ppt或pptx包含或哪些幻燈片包含子彈等詳細信息。如何使用c#從.pptx或.ppt文件中提取列表或項目符號細節#
請幫我找到它。 在此先感謝。
在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編輯器的代碼。當您在上面的項目符號後鍵入點時,智能感知系統將顯示可用的屬性。
有幾種方法。在下面的代碼,你可以看到文本的屬性,你可以在你的程序中訪問:
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中處理文本的更多詳細信息。
感謝您的幫助。它解決了我的問題。 – user2056958 2013-03-08 04:57:22
感謝您的回覆。現在我會嘗試在c#中實現這一點。 – user2056958 2013-02-11 12:06:48