本文介绍了如何在C#中的Footer of Word文档中查找和替换字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#中的Footer of Word文档中查找和替换字符串?

How to find and replace string in Footer of Word document in C#?

推荐答案


object replaceAll = MSWord.WdReplace.wdReplaceAll;

foreach (Microsoft.Office.Interop.Word.Section section in oDoc.Sections)
{
      Microsoft.Office.Interop.Word.Range footerRange = section.Footers[Microsoft.Office.Interop.Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
      footerRange.Find.Text = "Some Text";
      footerRange.Find.Replacement.Text = "Replace Text";
      footerRange.Find.Execute(ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref replaceAll, ref missing, ref missing, ref missing, ref missing);
                    }


这篇关于如何在C#中的Footer of Word文档中查找和替换字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 15:06