簡體   English   中英

從 Powerpoint 中提取項目符號文本

[英]Extract Bulleted Text From Powerpoint

我正在嘗試從 PowerPoint 幻燈片中提取項目符號文本。 但是我找不到任何有用的功能可以提供有關當前行是否在項目符號列表中的信息。 我嘗試使用縮進級別來識別它,但我也不覺得它有用。

例如:

如果幻燈片包含以下文本:

Abcdefg...
. B
. C
  . D
     .E

其中,有 5 個段落,如果獲取每個段落的縮進級別,它將變為:

Paragraph   IndentLevel
Abcdefg...   1
B            1
C            1
D            2
E            3

在這里,前 3 段具有相同的縮進級別,但在項目符號列表中只有 B 和 C,所以我的程序應該是 B、c、D、E。

在這里,我沒有辦法弄清楚這個段落是否以子彈開頭。

你能幫忙嗎?

謝謝,凱拉斯

編輯:

我用於檢索文本的代碼

public void analyzeText( PowerPoint.Shape shape )
{
    if( shape.HasTextFrame == Office.MsoTriState.msoTrue && shape.TextFrame.HasText == Office.MsoTriState.msoTrue )
    {
        PowerPoint.TextRange textRange = shape.TextFrame.TextRange;
        string text = textRange.Text;
        MessageBox.Show(text);
        for( int i=1; i<=textRange.Paragraphs().Count; i++)
        {
            MessageBox.Show("Paragram COunt : " + textRange.Paragraphs(i).Text + " Indent " + textRange.Paragraphs(i).IndentLevel);
        }
    }
}

您可以使用此方法來確定段落是否帶有項目符號:

blnBullet = oShp.TextFrame.TextRange.Paragraphs(x).ParagraphFormat.Bullet

感謝 JamieG 的幫助。 你的回答給了我暗示。 以下是我解決此問題的方法:

 PowerPoint.BulletFormat bulletFormat = textRange.Paragraphs(x).ParagraphFormat.Bullet;

    if( bulletFormat.Type == PowerPoint.PpBulletType.ppBulletNone )
                           // Not Bulleted
    else
                        // Bulleted

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM