使用javacript在MS Word文档中搜索和替换 [英] Search and Replace in a MS Word Document with javacript

查看:65
本文介绍了使用javacript在MS Word文档中搜索和替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



全部

我有一个MS Word文档,我想用Javascript进行搜索和替换。


是否有任何函数javascript这样做,发送给我?







谢谢

Hi
All
I got a MS Word Document and I′d like to do Search and Replace on it with Javascript.

Is there any function javascript that do this, to send me?





Thanks

推荐答案

嗨...


欢迎来到TSDN ...


请不要在论坛中发布你的电子邮件地址...我已经为了你自己的安全删除了它...我想你不会被垃圾邮件:)至少它'''反对发布规则...


你的问题:为什么你想这样做? word有自己的搜索和替换方法。顺便说一句。我认为没有可能用javascript做到这一点,因为javascript严格绑定到浏览器和网页(html,xml)......


亲切的问候
hi ...

welcome to TSDN ...

please DON''T post your email-address in the forums ... i''ve removed it for your own security ... i think you won''t get spammed :) and at least it''s against the posting rules ...

to your problem: why do you want to do that? word has its own search and replace method. btw. i think there is no possibility to do that with javascript since javascript is strictly bound to the browser and a webpage (html, xml) ...

kind regards


我认为有一种方法,但我不确定:

看看这个例子:


在C:\ \ Java \\ MyDocument.doc,我添加了添加我的文字在文件的开头。

所以我认为有一种方法可以替换变量docText并再次保存文件。


这个javascript打开word文档获取docText并添加该文本:(在文件开头添加我的文本。

I think there is one way, but I''m not sure:
Look at this example:

In C:\\Java\\MyDocument.doc, I add " Add My Texto " in the beginning of file.
So i thought there is one way to replace in the variable docText and save again the file.

This javascript open word document get the docText and add that text : (" Add My Texto " in beginning of file.


展开 | 选择 | 换行 | 行号


在这段代码中你使用了一个activeX-object ...它是IE特定的东西......因此我无法测试它来帮助你:) ...但是你可以发布什么obj.Content是什么?它是文档内容的纯文本吗?
in this code you use an activeX-object ... it''s IE specific stuff ... and therefore i cannot test it to help you :) ... but could you post what obj.Content is? is it plain text of the docs content?


这篇关于使用javacript在MS Word文档中搜索和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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