c# - 如何使用 Office interop 迭代 Word 文档中的段落项目?

标签 c# vsto office-interop

如何使用 Office interop 迭代 Word 文档中的段落项目(例如段落的图像、文本框等)?

最佳答案

这就是迭代文档段落的方法

foreach (Word.Paragraph paragraph in myDocument.Paragraphs)
{
   string pText = paragraph.Range.Text;
   System.Diagnostics.Debug.WriteLine(pText);

   Word.InlineShapes shapes = paragraph.Range.InlineShapes;
   System.Diagnostics.Debug.WriteLine("Shape Count: " + shapes.Count);
}

关于c# - 如何使用 Office interop 迭代 Word 文档中的段落项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32227384/

相关文章:

c# - LINQ to Object Join 运算符和相等性

c# - 一次从 DataTable 到 Excel 的范围?

excel - 使用 PowerShell 读取未安装 Office 的 Excel 文件

c# - UWP 中的异步绑定(bind)缩略图

c# - 为什么我不能声明一个从 Byte 继承的枚举但我可以从 byte 继承?

c# - 如何在 C# 中打开 Excel 文件?

c# - 使用 VSTO 而不是 VBA 创建 UDF

excel - 在 F# (Office.Interop) 中按字母顺序对 Excel 行进行排序

c# - 阅读下面的 xml 显示 c# 中的错误

c# - 使用资源键的绑定(bind)字段中的标题文本