Hello,
I have a word document in which I want to account the occurences of certain patterns of text such as "PW", "DW", "MH" etc.
I want the results displayed on a webpage so I figured since the machines this will run on don't have perl installed that javascript would be the next best thing. Unfortunately never used Javasript before so hence I'm asking for help!
So far by experimenting and using a providing website I've managed to retrieve the MS Word document text with the following code:
<html>
<head><title>snook.ca load document</title>
<script language="JavaScript">
<!--//
function loadworddoc(){
var doc = new ActiveXObject("Word.Application"
; // creates the word object
doc.Visible=false; // doesn't display Word window
doc.Documents.Open("X:\\DEV\\Retail Systems\\Projects\\COPOS\\60 - System Test Specifications\\Working Documents\\Registers\\Issues Log Registers Phase 1.doc"
; // specify path to document
//copy the content from my word document and throw it into my variable
var txt;
txt = doc.Documents("X:\\DEV\\Retail Systems\\Projects\\COPOS\\60 - System Test Specifications\\Working Documents\\Registers\\Issues Log Registers Phase 1.doc"
.Content;
document.all.myarea.value = txt;
document.all.myarea.value.substring(50, 70);
doucment.write(txt, "<BR>"
;
doc.quit(0); // quit word (very important or you'll quickly chew up memory!)
}
//-->
</script>
</head>
<body>
<p><input type=button onClick="loadworddoc();" value="Load">
<p><textarea name=myarea cols=50 rows=5>nothing here yet</textarea>
</body>
</html>
Just not sure how to search through what I've got and provide some results. Tried looking at regex but couldn't see anything that would do it.
Any ideas?
Cheers,
Pete
I have a word document in which I want to account the occurences of certain patterns of text such as "PW", "DW", "MH" etc.
I want the results displayed on a webpage so I figured since the machines this will run on don't have perl installed that javascript would be the next best thing. Unfortunately never used Javasript before so hence I'm asking for help!
So far by experimenting and using a providing website I've managed to retrieve the MS Word document text with the following code:
<html>
<head><title>snook.ca load document</title>
<script language="JavaScript">
<!--//
function loadworddoc(){
var doc = new ActiveXObject("Word.Application"
doc.Visible=false; // doesn't display Word window
doc.Documents.Open("X:\\DEV\\Retail Systems\\Projects\\COPOS\\60 - System Test Specifications\\Working Documents\\Registers\\Issues Log Registers Phase 1.doc"
//copy the content from my word document and throw it into my variable
var txt;
txt = doc.Documents("X:\\DEV\\Retail Systems\\Projects\\COPOS\\60 - System Test Specifications\\Working Documents\\Registers\\Issues Log Registers Phase 1.doc"
document.all.myarea.value = txt;
document.all.myarea.value.substring(50, 70);
doucment.write(txt, "<BR>"
doc.quit(0); // quit word (very important or you'll quickly chew up memory!)
}
//-->
</script>
</head>
<body>
<p><input type=button onClick="loadworddoc();" value="Load">
<p><textarea name=myarea cols=50 rows=5>nothing here yet</textarea>
</body>
</html>
Just not sure how to search through what I've got and provide some results. Tried looking at regex but couldn't see anything that would do it.
Any ideas?
Cheers,
Pete