|
|
Using JavaScript to Open Excel and Word Files in HTML - Javascript
|
Views : 865
|
|
Tagged in : Javascript
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
<a href="bank/sheet.xls" >some excel file </a>
Another approach is via JavaScript.
<script type="text/javascript">
function openExcel(strFilePath) {
var yourSite = "http://www.yoursite.com";
openExcelDocPath(yourSite + strFilePath, false);
}
function openExcelDocPath(strLocation, boolReadOnly) {
var objExcel;
objExcel = new ActiveXObject("Excel.Application");
objExcel.Visible = true;
objExcel.Workbooks.Open(strLocation, false, boolReadOnly);
}
</script>
To open a word document with javascript, go with the following code:
<script type="text/javascript">
function openWord(strFilePath) {
var yourSite = "http://www.yoursite.com";
openWordDocPath(yourSite + strFilePath);
}
function openWordDocPath(strLocation) {
var objWord;
objWord = new ActiveXObject("Word.Application");
objWord.Visible = true;
objWord.Documents.Open(strLocation);
}
</script>
|
|
By kalai, On - 2010-02-01 |
|
|
|