
June 8th, 2011, 07:47 PM
|
Registered User
|
|
Join Date: Jun 2011
Posts: 1
Time spent in forums: 22 m
Reputation Power: 0
|
|
Other - Coding Help: Display Excel Worksheets in a web page
I am trying to display a excel worksheet on a web page. I have four tabs (sheets) in one excel document that needs to be displayed separately in intervals. So in other words I would like to see Tab 1 displayed on a web page for 10 seconds, followed by tab 2 etc.... I want this to continue without stopping. This is the code I have right now. It displays only one tab.
<html>
<head>
<title>Cast App Dashboard</title>
<style type="text/css">
h1 {font-family: Tahoma; font-size: 24pt; text-align: center}
h2 {font-family: Tahoma; font-size: 16pt; text-align: center; font-weight:normal}
table {font-family: Tahoma; font-size: 7pt; text-align: center; background: black; border-width: 0 0 1px 1px; border-spacing: 0; border-collapse: collapse; border-style: solid; }
td {margin: 0;padding: 4px; border-width: 1px 1px 0 0; border-style: solid;}
</style>
<script>
function start() {
var excel = new ActiveXObject("Excel.Application");
var book = excel.Workbooks.Open("....xlsx");
var sheet = book.Sheets.Item(1);
var body = document.getElementsByTagName("body")[0];
var tbl = document.createElement("table");
var tblBody = document.createElement("tbody");
for (var j = 0; j < 9; j++) {
var row = document.createElement("tr");
for (var i = 0; i < 17; i++) {
var cell = document.createElement("td");
cell.style.background = "#E6E6E6";
var cellBackground = sheet.Cells(j+1,i+1).Interior.colorIndex;
if (cellBackground == 6) { cell.style.background = "#F7FE2E"; }
if (cellBackground == 37) { cell.style.background = "#2E64FE"; }
if (cellBackground == 43) { cell.style.background = "#088A08"; }
if (cellBackground == 3) { cell.style.background = "red"; }
var cellText = document.createTextNode(sheet.Cells(j+1,i+1).Value );
if (j==0) { cell.style.color = "white"; }
if (i<3 && j==0) { cell.style.background = "#424242"; }
if (i>=3 && i<6 && j==0) { cell.style.background = "#990000"; }
if (i>=6 && i<10 && j==0) { cell.style.background = "#2A120A"; }
if (i>=10 && j==0) { cell.style.background = "#0B173B"; }
cell.appendChild(cellText);
row.appendChild(cell);
}
tblBody.appendChild(row);
}
tbl.appendChild(tblBody);
body.appendChild(tbl);
tbl.setAttribute("border", "2");
excel.Quit();
}
</script>
</head>
<body onload="start()">
<h1>Cast App Dashboard</h1>
<h2>Sub-domain: Analytics</h2><br><br>
</body>
</html>
Any help would be appreciated.
|