[英]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.