使用asp.net替换doc文档中的某些文本 [英] repalce some text in doc document using asp.net

查看:77
本文介绍了使用asp.net替换doc文档中的某些文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用asp.net(C#)替换doc文档中的某些单词,样式无法更改,这些单词在表格中,
谁能帮助我?
如果可以提供附件,它将使我更轻松地工作

i need to replace some words in doc document using asp.net(C#),the style could not be changed,the words are in tables,
who could help me?
if you could provid attachment,it will make me work more easily

推荐答案

表格中的单词与html表格中的单词一样,对吗? (不是DB表!)

方式之一:
使用Javascript&工作宏

由于考虑的是Web应用程序,因此您要查询的内容不仅需要Javascript知识,还需要 Microsoft Word宏语言和 ActiveX自动化知识,您可以通过该知识访问单词申请.

要了解有关后者的更多信息,您需要了解Javascript"ActiveXObject"和"GetObject",并且需要浏览Microsoft Word帮助文件以获取有关Microsoft Word对象模型和自动化的信息.有关单词的宏语言的完整信息可以在其帮助文件中找到.

首先,当您打开Word文档时,可以使用以下方法获得Word自动化对象的句柄:-

var oWord = GetObject(","Word.Application");
var oActiveDocument = oWord.ActiveDocument;

如果需要,可以在MS Word的帮助文件中找到其余的内容.
Words in table as in html table in word, right? (not DB table!)

One of the ways:
Using Javascript & Work Macro

Since it''s a Web application in consideration, what you are asking requires knowledge not only of Javascript but of the Microsoft Word Macro Language and ActiveX automation through which you can access the word application.

To learn more about the latter you need to learn about the Javascript "ActiveXObject" and "GetObject" and you need to look through the Microsoft Word help files for information on the Microsoft Word Object Model and automation. Full information on word''s Macro language can be found in its help files.

To give you a starter, when your Word Document is open, you can get a handle on the Word automation object using:-

var oWord=GetObject("","Word.Application");
var oActiveDocument=oWord.ActiveDocument;

The rest of it you can find in MS Word''s help files if you look for it.


这篇关于使用asp.net替换doc文档中的某些文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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