文檔金喜正規買球>>Aspose中文文檔>>查找和替換文本
查找和替換文本
Aspose.Words是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式處理,并允許將各類文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
VSTO
Word.Application wordApp = Application; wordApp.Documents.Open("Search and Replace.doc"); object replaceAll = Word.WdReplace.wdReplaceAll; this.Application.Selection.Find.ClearFormatting(); this.Application.Selection.Find.Text = "find me"; this.Application.Selection.Find.Replacement.ClearFormatting(); this.Application.Selection.Find.Replacement.Text = "Found"; this.Application.Selection.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);
點擊復制
Aspose.Words
Document doc = new Document("Search and Replace.doc"); doc.Range.Replace("find me", "found", false, true); doc.Save("Search and Replace.doc");
點擊復制
下載示例代碼