-
如何使用DocX 库在 .DOCX 文件中替换一列单词
翻译 maninwest@Codeforge 作者:B. Clay Shannon@Codeproject使用 DocX 库替换 .docx 文件中的字任务我想替换英式英语的拼写为美式口语。例如, 替换 "colour" 为 "color", "centre" 为 "center", "plough" 为"plow", 等。我可以使用查找>替换来一个一个地替换,但是很麻烦。所以,我找到一个库 。为了使用这个 docx库,只需从 这里 下载(docx.dll)。在你的项目中添加到它的引用,然后添加此 using子句:using Novacode;
首先需要加载具有”错误"拼写的文档:string filename = string.Empty;
DialogResult result = openFileDialog1.ShowDialog();
if (result == DialogResult.OK)
{
filename = openFileDialog1.FileName;
}
else
{
MessageBox.Show("No file selected - hasta la vista and Ciao, baby!");
return;
}
using (DocX document = DocX.Load(filename))
{
document.ReplaceText("travelled", "traveled");
document.Save();
}
我们当然想以此完成所有词汇替换。首先,我们需要有一列单词,这样编码: 请点击左侧文件开始预览 !预览只提供20%的代码片段,完整代码需下载后查看 加载中 侵权举报
- 2022-01-25 21:24:19下载
- 积分:1
-
cytoscape mannual, 描述了基于JRE的network应用软件
cytoscape mannual, 描述了基于JRE的network应用软件-cytoscape mannual, describes the network-based applications JRE
- 2022-03-10 10:36:01下载
- 积分:1
-
功能强大的网上书店系统,用户登录,管理,书籍浏览,新书上架...
功能强大的网上书店系统,用户登录,管理,书籍浏览,新书上架-A powerful online bookstore system, user login, management, book browsing, book shelves, etc.
- 2022-05-20 12:40:03下载
- 积分:1
-
(C语言)十进制转为任意进制
编程实践,十进制转为任意进制,R是你要转的进制。已过COJ1147。
- 2022-03-19 14:42:35下载
- 积分:1
-
tree controls advanced version
树形控件高级版本-tree controls advanced version
- 2022-04-23 19:24:45下载
- 积分:1
-
Chinese chess source, the use of Windows SDK development.
中国象棋源码,使用Windows SDK开发。-Chinese chess source, the use of Windows SDK development.
- 2022-11-29 01:20:04下载
- 积分:1
-
这是一个移动屏幕的创造者,我们可以有一个小键盘
this a mobile screen creator,we can have a keypad
- 2022-03-23 20:39:26下载
- 积分:1
-
C++Builder成绩提交小程序
C++Builder成绩提交小程序-C Builder results submitted small program
- 2022-02-05 12:04:22下载
- 积分:1
-
In the spirit of taking things too far, here is a fully functional 5
In the spirit of taking things too far, here is a fully functional 5-dimensional analogue of Rubik s cube.
- 2022-07-18 19:41:00下载
- 积分:1
-
Window scripts technology contains various technical languages: VB, JAVA script,...
Window的脚本技术含有各种的技术语言:VB、JAVA等脚本技术的讲解!-Window scripts technology contains various technical languages: VB, JAVA script, etc. on technology!
- 2023-02-12 23:35:03下载
- 积分:1