文檔首頁>>Aspose中文文檔>>查找和替換文本
查找和替換文本
Aspose.Words是一種高級(jí)Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。API支持生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印文檔,而無需在跨平臺(tái)應(yīng)用程序中直接使用Microsoft Word。
Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。
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);
點(diǎn)擊復(fù)制
Aspose.Words
Document doc = new Document("Search and Replace.doc"); doc.Range.Replace("find me", "found", false, true); doc.Save("Search and Replace.doc");
點(diǎn)擊復(fù)制
下載示例代碼