Search text in a Word document with javascript

java , javascript New Zealand
  • 9 years ago

    Hi All,

    I have a word document I open with the following code, what I'm trying to do is search the document for a particular piece of text "[FILE_NUMBER]" that can reside in either the header, footer or body of the document.

    doc = new ActiveXObject("Word.Application");
    doc.Visible = false;
    doc.Documents.Open("C:\\Inetpub\\wwwroot\\biz_e_asset_new\\styles\\report_templates\\service_request_template3.doc", null, true);
    var oDocument=doc.ActiveDocument;
    //At this point I'd like to search the header,footer,body
    doc.quit(0); 

    Does anyone know how to retrieve these pieces of content. Any help greatly appreciated!!!

    Regards Hayden

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“C++: an octopus made by nailing extra legs onto a dog.” - Steve Taylor