tags:

views:

704

answers:

3

Hi, I have trid to load (embed) the .doc file into the html page using object tag. And it doesnt show the word toolbar. My requirement is to allow the user to print the doc from print option in word.

is there a possible way in javascript to enable the word toolbars??

And i have tried another approach using the ActiveXObject.. but this method opens the document in winword.exe.. is tehre a way to embed the .doc file through javascript..?

Cheers

RameshVel

A: 
<HTML>
<HEAD>
<TITLE>MSWORD App through JavaScript</TITLE>
</HEAD>
<BODY>
<script>
var w=new ActiveXObject('Word.Application');
var docText;
var obj;
if (w != null)
{
w.Visible = true; // you can change here visible or not 
obj=w.Documents.Open("C:\\A.doc");
docText = obj.Content;
w.Selection.TypeText("Hello");
w.Documents.Save();
document.write(docText);//Print on webpage

/*The Above Code Opens existing Document
set w.Visible=false
*/
/*Below code will create doc file and add data to it and will close*/
w.Documents.Add();
w.Selection.TypeText("Writing This Message ....");
w.Documents.Save("c:\\doc_From_javaScript.doc");
w.Quit();
/*Don't forget
set w.Visible=false */

}
joe
this is wat i have said actually.. but this method opens the document in winword.exe.. is tehre a way to embed the .doc file through javascript..?i dont want to open the doc in standalone winword.exe.. it must be opened within a browser with all the tollbars enabled.Enbedding .doc using the object doesnt show the word toolbar. this is the sample code i ve tried<object width="800" height="4000px" id="oWord" data="samtest.doc" classid="clsid:00020906-0000-0000-C000-000000000046">CheersRamesh Vel
Ramesh Vel
A: 

i was looking for other possibilites, but nothing works

1.anybody got an idea about the list of params available for the Word ActiveX.

may be that could contain the proprty to enable toolbars on load..

2.i used the below code to load .doc content to ActiveX Word Document control

var objWord = new ActiveXObject("Word.Application"); objWord.Visible=false; var Doc=new ActiveXObject("Word.Document"); Doc=objWord.Documents.Add("c:\test.doc", true);

is there a way to render the DOC element directly into HTML.. like putting this elemnt in iframe or whatever??

3.I was assigining the iframe source property directly to the doc file. like this

this loads the doc into browser

, but this prompt to open a downloader window.

i really apreciate any hint that lead me to some direction

cheers Ramesh Vel

Ramesh Vel
A: 

how to clear the data in word doc and how make a new line in that created documetn

m.koteswararao