替换来一个一个地替换,但是很麻烦。所以,我找到一个库。为了使用这个docx库,只需从这里下载(docx.dll)。在你的项目中添加到它的引用,然后添加此using子句:usingNovacode;首先需要加载具有”错误"拼写的文档:stringfilename=string.Empty;DialogResultresult=openFileDialog1.ShowDialog();if(result==DialogResult.OK){filename=openFileDialog1.FileName;}else{MessageBox.Show("Nofileselected-hastalavistaandCiao,baby!");return;}using(DocXdocument=DocX.Load(filename)){document.ReplaceText("travelled","traveled");document.Save();}我们当然想以此完成所有词汇替换。首先,我们需要有一列单词,这样编码: 请点击左侧文件开始预览!预览只提供20%的代码片段,完整代码需下载后查看加载中侵权举报-IMDN开发者社群-imdn.cn"> 替换来一个一个地替换,但是很麻烦。所以,我找到一个库。为了使用这个docx库,只需从这里下载(docx.dll)。在你的项目中添加到它的引用,然后添加此using子句:usingNovacode;首先需要加载具有”错误"拼写的文档:stringfilename=string.Empty;DialogResultresult=openFileDialog1.ShowDialog();if(result==DialogResult.OK){filename=openFileDialog1.FileName;}else{MessageBox.Show("Nofileselected-hastalavistaandCiao,baby!");return;}using(DocXdocument=DocX.Load(filename)){document.ReplaceText("travelled","traveled");document.Save();}我们当然想以此完成所有词汇替换。首先,我们需要有一列单词,这样编码: 请点击左侧文件开始预览!预览只提供20%的代码片段,完整代码需下载后查看加载中侵权举报 - IMDN开发者社群-imdn.cn">
登录
首页 » Windows开发 » 如何使用DocX 库在 .DOCX 文件中替换一列单词

如何使用DocX 库在 .DOCX 文件中替换一列单词

于 2022-01-25 发布 文件大小:58.41 kB
0 154
下载积分: 2 下载次数: 1

代码说明:

翻译  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%的代码片段,完整代码需下载后查看 加载中 侵权举报

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 使用ssm框架实现类似淘宝京东购物模块
    在eclipse上开发,采用ssm框架对购物车进行整合,实现增删改查,采用jsp能实现一些页面的判断等。
    2022-09-14 09:15:05下载
    积分:1
  • 用 C++ 创建简单的 Win32 服务程序(NTServCpl) 详细信息 < NT服务 > 《用 C++ 创建简单的 Win32 服务程序》一文...
    用 C++ 创建简单的 Win32 服务程序(NTServCpl) 详细信息 < NT服务 > 《用 C++ 创建简单的 Win32 服务程序》一文的例子代码。描述如何用 Visual C++ 创建 Windows NT 服务程序。创建该服务仅用到一个 C++ 类,这个类提供服务与操作系统之间一个简单的接口。使用这个类实现自己的服务非常简单,只要改写少数几个基类中的虚拟函数即可。文中有三个源代码参考例子:这是其中之一―― NTServCpl:是一个控制面版程序,用来控制 NTService 服务; 其余两个分别为: NTService:是一个简单的 Win32 服务,它就是用本文所描述的方法建立的; NTServCtrl:是一个独立的程序例子,用它可以监控某个 Win32 服务;-create simple Win32 services (NTServCpl) detailed information lt; NT services gt; "C create simple Win32 service procedures," a text of the code examples. Describe how to use Visual C create Windows NT service procedures. Creation of the service only to a category C, the category of services provided between an operating system with a simple interface. Use this category to realize their services are very simple, as long as rewriting a few of the base class function can be virtual. The text has three reference source code example : This is one of them-- NTServCpl : console is a procedure used to control NTService services; The remai
    2022-08-09 22:47:02下载
    积分:1
  • 一个面向对象的计算器
    一个面向对象的计算器-an object-oriented calculators
    2022-02-05 23:22:38下载
    积分:1
  • 我写的方块源代码
    我写的方块源代码-I write source code block
    2023-05-29 08:25:03下载
    积分:1
  • 使用单链表实现本程序要求,单链表每个节点存储一个学生的信息。 创建一个链表类(List),链表类可实现如下功能: 创建链表,插入节点,删除节点,编辑节点...
    使用单链表实现本程序要求,单链表每个节点存储一个学生的信息。 创建一个链表类(List),链表类可实现如下功能: 创建链表,插入节点,删除节点,编辑节点,显示节点,保存链表信息等功能,读入数据文件等功能(详细说明请查看源代码)。 创建一个操作类(Operater),操作类实现如下功能: 显示菜单,操作链表。-use a single linked list to achieve the procedural requirements of each node-Chain store a student information. Create a Chain category (List), objectlist can achieve the following functions : Create List, insert nodes, the nodes to delete, edit nodes, nodes showed that the preservation Chain information and other functions, read features such as data files (see detailed description of the source code). The creation of a category of operation (Operater), the operation to achieve the following functional categories : display menu, operation List.
    2022-02-13 06:34:24下载
    积分:1
  • M-序列模糊函数,其中包含模糊函数,频移差为0和时移差为0时的函数图形。-M-sequence ambiguity function, which includes fuzzy function, frequency shift difference for the 0 and times have changed for the worse 0:00 a function of graphics.
    2022-01-24 15:14:16下载
    积分:1
  • 塔锚链塔德传输德基地
    matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地matlab 仿真塔锚链塔德传输德基地
    2022-02-24 15:38:58下载
    积分:1
  • 一个简单的文字识别软件,vc++做的,用office2003所带的组件,识别英文很好,汉字识别不出来...
    一个简单的文字识别软件,vc++做的,用office2003所带的组件,识别英文很好,汉字识别不出来-A simple character recognition software, vc++ to do with the components brought office2003, identify good English, Chinese character recognition does not come out
    2022-12-30 19:05:04下载
    积分:1
  • net rar
    net rar- net rar
    2022-03-18 17:59:17下载
    积分:1
  • BOC信号仿真
    BOC signal simulation
    2022-06-26 08:40:55下载
    积分:1
  • 696518资源总数
  • 106208会员总数
  • 21今日下载