Lire un fichier excel (advanced news scroller)
Bonjour, je viens demande l' aide d' experts en javascripts, cela fait deja quelques mois maintenant que cette app a cesser de fonctionnée
apres plusieurs tentatives, la function readfromexcel est toujours bloquée:
voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
|
<!doctype html>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
function readFromExcel(x,y)
{
var excel = new ActiveXObject("Excel.Application");
var excel_file = excel.Workbooks.Open("./data.xlsx");
var excel_sheet = excel_file.Worksheets("Sheet1");
var data = excel_sheet.Cells(x,y).Value;
excel.Quit();
return data;
}
function changecssstyleAPPSER(sla)
{
var style ;
if (sla >= 95) {
style = "green";
} else {
style = "red";
}
return style
}
function changecssstyleREADE(sla)
{
var style ;
if (sla >= 90) {
style = "green";
} else if (sla < 90 && sla >=80) {
style = "yellow";
}else {
style = "red";
}
return style
}
function changecssstyleREADSL(sla)
{
var style ;
if (sla >= 95) {
style = "green";
} else {
style = "red";
}
return style
}
function loaddata()
{
//SLA MS
//MS APPSER
var APPSERMS = null;
var labelAPPSERMS = document.getElementById('APPSERMS');
APPSERMS = (readFromExcel(3,4)*100).toFixed(2);
labelAPPSERMS.innerHTML = APPSERMS;
labelAPPSERMS.className = changecssstyleAPPSER(APPSERMS);
//MS READEC
var READECMS = null;
var labelREADECMS = document.getElementById('READECMS');
READECMS = (readFromExcel(3,6)*100).toFixed(2);
labelREADECMS.innerHTML = READECMS;
labelREADECMS.className = "";
labelREADECMS.className = changecssstyleREADE(READECMS);
//MS READSL
var READSLMS = null;
var labelREADSLMS = document.getElementById('READSLMS');
READSLMS = (readFromExcel(3,8)*100).toFixed(2);
labelREADSLMS.innerHTML = READSLMS;
labelREADSLMS.className = changecssstyleREADSL(READSLMS);
//SLA RC
//RC APPSER
var APPSERRC
var labelAPPSERRC = document.getElementById('APPSERRC');
APPSERRC = (readFromExcel(3,11)*100).toFixed(2);
labelAPPSERRC.innerHTML = APPSERRC;
labelAPPSERRC.className = changecssstyleAPPSER(APPSERRC);
//RC READEC
var READECRC
var labelREADECRC = document.getElementById('READECRC');
READECRC = (readFromExcel(3,13)*100).toFixed(2);
labelREADECRC.innerHTML = READECRC;
labelREADECRC.className = changecssstyleREADE(READECRC);
//RC READSL
var READSLRC
var labelREADSLRC = document.getElementById('READSLRC');
READSLRC = (readFromExcel(3,15)*100).toFixed(2);
labelREADSLRC.innerHTML = READSLRC;
labelREADSLRC.className = changecssstyleREADSL(READSLRC);
//SLA HD
//HD APPSER
var APPSEREPHD
var labelAPPSEREPHD = document.getElementById('APPSEREPHD');
APPSEREPHD = (readFromExcel(3,18)*100).toFixed(2);
labelAPPSEREPHD.innerHTML = APPSEREPHD;
labelAPPSEREPHD.className = changecssstyleAPPSER(APPSEREPHD);
//HD READECEP
var READECEPHD
var labelREADECEPHD = document.getElementById('READECEPHD');
READECEPHD = (readFromExcel(3,20)*100).toFixed(2);
labelREADECEPHD.innerHTML = READECEPHD;
labelREADECEPHD.className = changecssstyleREADE(READECEPHD);
//HD READSLEP
var READSLEPHD;
var labelREADSLEPHD = document.getElementById('READSLEPHD');
READSLEPHD = (readFromExcel(3,22)*100).toFixed(2);
labelREADSLEPHD.innerHTML = READSLEPHD;
labelREADSLEPHD.className = changecssstyleREADSL(READSLEPHD);
var div = document.getElementById('scroller');
div.innerHTML = div.innerHTML + '';
}
setTimeout(function(){
loaddata();
window.location.reload(1);
}, 600000);
</script>
<style type="text/css">
/* Scroller Box */
#scroller_container {
position: relative;
width: 1900px;
height: 110px;
overflow: hidden;
padding-bottom:25px
}
#scroller {
white-space: nowrap;
line-height: 80px;
font-size: 70px;
margin-top:25px;
}
#scroller p {
padding: 0;
}
.colorMS {
height:100px;
background-color:#1A386F;
/*background-color:#948b54;*/
border:#C7C7C7 2px solid;
color:#FFFFFF;
}
.colorRC {
height:100px;
background-color:#1A386F;
/*background-color:#b1a1c8;*/
border:#C7C7C7 2px solid;
color:#FFFFFF;
}
.colorEPHD {
height:100px;
background-color:#1A386F;
/*background-color:#808080;*/
border:#C7C7C7 2px solid;
color:#FFFFFF;
}
.red {
height:100px;
background-color: #FF0000;
border:#C7C7C7 2px solid;
margin-right:15px;
}
.yellow
{
height:100px;
background-color:#D9980E;
border:#C7C7C7 2px solid;
margin-right:15px;
}
.green
{
height:100px;
background-color: #0f0;
border:#C7C7C7 2px solid;
margin-right:15px;
}
body{
background-color:#1A386F;
font-size:45px;
}
/* Scoller Box */
</style>
<script type="text/javascript" src="jquery-1.11.0.js"></script>
<script type="text/javascript" src="jscroller-0.4.js"></script>
<script type="text/javascript">
$(document).ready(function(){
// Add Scroller Object
$jScroller.add("#scroller_container","#scroller","left",12);
// Start Autoscroller
$jScroller.start();
});
</script>
</head>
<body onLoad="loaddata()">
<div id="scroller_container">
<div id="scroller">
<label class="colorMS">MS</label>
<label class="colorMS">MS APPSER</label>
<label class="" ID='APPSERMS'></label>
<label class="colorMS">MS READEC</label>
<label class="" ID='READECMS'></label>
<label class="colorMS">MS READSL</label>
<label class="" ID='READSLMS'></label>
<label class="colorRC">RC</label>
<label class="colorRC">RC APPSER</label>
<label class="" ID='APPSERRC'></label>
<label class="colorRC">RC READEC</label>
<label class="b" ID='READECRC'></label>
<label class="colorRC">RC READSL</label>
<label class="" ID='READSLRC'></label>
<label class="colorEPHD">EP/HD</label>
<label class="colorEPHD">EP/HD APPSER</label>
<label class="" ID='APPSEREPHD'></label>
<label class="colorEPHD">EP/HD READEC</label>
<label class="" ID='READECEPHD'></label>
<label class="colorEPHD">EP/HD READSL</label>
<label class="" ID='READSLEPHD'></label>
</div>
</div>
</body>
</html> |
Merci d' avance pour votre aide.