I have an excel sheet containing an excel diagram. I can display an excel sheet in a browser using an iframe. However, I only want to display the graph present inside the excel sheet in the browser.
How do I achieve this? I see that this requires the Javascript + ActiveX API. I tried, but could not get it to work.
See the code below. This does not work, since I cannot set the data attribute of the "object" tag dynamically. This does not allow.
<object id="objFrame" data="" type="application/vnd.ms-excel"></object>
<script>
var Excel = new ActiveXObject("Excel.Application");
Excel.Visible = false;
document.getElementById("objFrame").data = Excel.Workbooks.Open("Test.xls").Sheets("Chart1");
Excel.Quit();
</script>
Is there any other way to achieve this? Please send a sample code. Thanks.
source
share