打开已编辑的Word文档 [英] Open edited Word document

查看:78
本文介绍了打开已编辑的Word文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿!

是否可以制作:OpenFileDialog - >选择现有文件(MS Word) - >以编程方式格式化文本 - >打开已编辑的文件



[语言:Visual Basic]

Hey!
Is it possible to make: OpenFileDialog -> Select existing File (MS Word) -> Programmatically Format Text -> Open edited file

[Language: Visual Basic]

推荐答案

 如果你有已安装MS Word, 您可以添加对 Microsoft Word对象库的引用你的项目。 使用此, 您可以在不可见的Word应用程序中打开
文件。 进行文本格式化(通过代码),然后将Word应用程序的窗口设置为Visible。 如果需要,您也可以保存文件。 没有必要打开,编辑,关闭,然后重新打开它。

 If you have MS Word installed,  you can add a reference to Microsoft Word Object Library in your project.  Using this,  you can open the file in a non-visible Word application.  Do your text formatting (through code) and then set the Word application's window to Visible.  You can save the file too if you want.  There would be no need to open, edit, close, and then reopen it again.

 这需要一些搜索示例并尝试使用它们来获取虽然用它来使用它。 下面的第一个链接是一个微软文档,它解释了如何添加对项目的引用。 它还有一个示例
,用于创建新文档并在文档中添加一些常用内容。

 It will require a bit of searching for examples and experimenting with them to get use to using it though.  The first link below is a microsoft document which explains how to add the reference to your project.  It also has an example of creating a new document and adding some common things to the document.

  如何自动化Word从Visual Basic .NET创建新文档

 这是格式化文本的另一个msdn代码示例。

 Here is another msdn code example of formatting text.

  如何:以编程方式格式化文档中的文本

 此链接显示了一些常见内容的示例,例如查找文本,枚举段落或句子, 加上更多。

 This link shows some examples of doing some common things like finding text, enumerating paragraphs or sentences,  plus more.

  使用Word文档内容对象

 如果您在更多内容中进行了解释通过"格式文本"详细说明您的意思,我或其他人可能会有一些示例向您展示。 你想改变文字颜色, 文字大小, 页边距, 字体类型, 或????

 If you explained in more detail what you mean by 'Format Text' , me or someone else may have some examples to show you.  Do you want to change text color,  text size,  page margins,  font types,  or ????

 





这篇关于打开已编辑的Word文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆