質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,315 +29,3 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
お力添えいただけると幸いです。
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
【追記】
|
40
|
-
|
41
|
-
無駄な部分も多いかと思いますが・・・
|
42
|
-
|
43
|
-
xlsxファイルをなんとか表示できるようになりました。
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
ただ、
|
48
|
-
|
49
|
-
$('.' + dataNo+i).find('.na').text(work[i].__EMPTY_1);
|
50
|
-
|
51
|
-
$('.' + dataNo+i).find('.' + tdName+5).text(work[i].__EMPTY_5);
|
52
|
-
|
53
|
-
$('.' + dataNo+i).find('.' + tdName+6).text(work[i].__EMPTY_6);
|
54
|
-
|
55
|
-
$('.' + dataNo+i).find('.' + tdName+7).text(work[i].__EMPTY_7);
|
56
|
-
|
57
|
-
$('.' + dataNo+i).find('.' + tdName+8).text(work[i].__EMPTY_8);
|
58
|
-
|
59
|
-
の部分が、まとめれたらなとも感じております。
|
60
|
-
|
61
|
-
以下がコードです。
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
```html
|
66
|
-
|
67
|
-
<!DOCTYPE html>
|
68
|
-
|
69
|
-
<html lang="ja">
|
70
|
-
|
71
|
-
<head>
|
72
|
-
|
73
|
-
<meta charset="unicode">
|
74
|
-
|
75
|
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.1/xlsx.full.min.js"></script>
|
76
|
-
|
77
|
-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
78
|
-
|
79
|
-
<title>サンプル</title>
|
80
|
-
|
81
|
-
</head>
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
<body>
|
86
|
-
|
87
|
-
<h1>サンプル</h1>
|
88
|
-
|
89
|
-
<table>
|
90
|
-
|
91
|
-
<tr class="data1">
|
92
|
-
|
93
|
-
<td class="na"></td>
|
94
|
-
|
95
|
-
<td class="td5"></td>
|
96
|
-
|
97
|
-
<td class="td6"></td>
|
98
|
-
|
99
|
-
<td class="td7"></td>
|
100
|
-
|
101
|
-
<td class="td8"></td>
|
102
|
-
|
103
|
-
<td class="td9"></td>
|
104
|
-
|
105
|
-
<td class="td10"></td>
|
106
|
-
|
107
|
-
<td class="td11"></td>
|
108
|
-
|
109
|
-
<td class="td12"></td>
|
110
|
-
|
111
|
-
<td class="td13"></td>
|
112
|
-
|
113
|
-
<td class="td14"></td>
|
114
|
-
|
115
|
-
<td class="td15"></td>
|
116
|
-
|
117
|
-
<td class="td16"></td>
|
118
|
-
|
119
|
-
<td class="td17"></td>
|
120
|
-
|
121
|
-
<td class="td18"></td>
|
122
|
-
|
123
|
-
<td class="td19"></td>
|
124
|
-
|
125
|
-
</tr>
|
126
|
-
|
127
|
-
<tr class="data2">
|
128
|
-
|
129
|
-
<td class="na"></td>
|
130
|
-
|
131
|
-
<td class="td5"></td>
|
132
|
-
|
133
|
-
<td class="td6"></td>
|
134
|
-
|
135
|
-
<td class="td7"></td>
|
136
|
-
|
137
|
-
<td class="td8"></td>
|
138
|
-
|
139
|
-
<td class="td9"></td>
|
140
|
-
|
141
|
-
<td class="td10"></td>
|
142
|
-
|
143
|
-
<td class="td11"></td>
|
144
|
-
|
145
|
-
<td class="td12"></td>
|
146
|
-
|
147
|
-
<td class="td13"></td>
|
148
|
-
|
149
|
-
<td class="td14"></td>
|
150
|
-
|
151
|
-
<td class="td15"></td>
|
152
|
-
|
153
|
-
<td class="td16"></td>
|
154
|
-
|
155
|
-
<td class="td17"></td>
|
156
|
-
|
157
|
-
<td class="td18"></td>
|
158
|
-
|
159
|
-
<td class="td19"></td>
|
160
|
-
|
161
|
-
</tr>
|
162
|
-
|
163
|
-
<tr class="data3">
|
164
|
-
|
165
|
-
<td class="na"></td>
|
166
|
-
|
167
|
-
<td class="td5"></td>
|
168
|
-
|
169
|
-
<td class="td6"></td>
|
170
|
-
|
171
|
-
<td class="td7"></td>
|
172
|
-
|
173
|
-
<td class="td8"></td>
|
174
|
-
|
175
|
-
<td class="td9"></td>
|
176
|
-
|
177
|
-
<td class="td10"></td>
|
178
|
-
|
179
|
-
<td class="td11"></td>
|
180
|
-
|
181
|
-
<td class="td12"></td>
|
182
|
-
|
183
|
-
<td class="td13"></td>
|
184
|
-
|
185
|
-
<td class="td14"></td>
|
186
|
-
|
187
|
-
<td class="td15"></td>
|
188
|
-
|
189
|
-
<td class="td16"></td>
|
190
|
-
|
191
|
-
<td class="td17"></td>
|
192
|
-
|
193
|
-
<td class="td18"></td>
|
194
|
-
|
195
|
-
<td class="td19"></td>
|
196
|
-
|
197
|
-
</tr>
|
198
|
-
|
199
|
-
<tr class="data4">
|
200
|
-
|
201
|
-
<td class="na"></td>
|
202
|
-
|
203
|
-
<td class="td5"></td>
|
204
|
-
|
205
|
-
<td class="td6"></td>
|
206
|
-
|
207
|
-
<td class="td7"></td>
|
208
|
-
|
209
|
-
<td class="td8"></td>
|
210
|
-
|
211
|
-
<td class="td9"></td>
|
212
|
-
|
213
|
-
<td class="td10"></td>
|
214
|
-
|
215
|
-
<td class="td11"></td>
|
216
|
-
|
217
|
-
<td class="td12"></td>
|
218
|
-
|
219
|
-
<td class="td13"></td>
|
220
|
-
|
221
|
-
<td class="td14"></td>
|
222
|
-
|
223
|
-
<td class="td15"></td>
|
224
|
-
|
225
|
-
<td class="td16"></td>
|
226
|
-
|
227
|
-
<td class="td17"></td>
|
228
|
-
|
229
|
-
<td class="td18"></td>
|
230
|
-
|
231
|
-
<td class="td19"></td>
|
232
|
-
|
233
|
-
</tr>
|
234
|
-
|
235
|
-
</table>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
<script>
|
240
|
-
|
241
|
-
var url = "testdata.xlsx";
|
242
|
-
|
243
|
-
var oReq = new XMLHttpRequest();
|
244
|
-
|
245
|
-
oReq.open("GET", url, true);
|
246
|
-
|
247
|
-
oReq.setRequestHeader('Pragma', 'no-cache');
|
248
|
-
|
249
|
-
oReq.setRequestHeader('Cache-Control', 'no-cache');
|
250
|
-
|
251
|
-
oReq.setRequestHeader('If-Modified-Since', 'Thu, 01 Jun 1970 00:00:00 GMT');
|
252
|
-
|
253
|
-
oReq.responseType = "arraybuffer";
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
oReq.onload = function(e) {
|
258
|
-
|
259
|
-
var arraybuffer = oReq.response;
|
260
|
-
|
261
|
-
var data = new Uint8Array(arraybuffer);
|
262
|
-
|
263
|
-
var arr = new Array();
|
264
|
-
|
265
|
-
for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
|
266
|
-
|
267
|
-
var bstr = arr.join("");
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
var workbook = XLSX.read(bstr, {type:"binary"});
|
272
|
-
|
273
|
-
var first_sheet_name = workbook.SheetNames[0];
|
274
|
-
|
275
|
-
var worksheet = workbook.Sheets[first_sheet_name];
|
276
|
-
|
277
|
-
work =XLSX.utils.sheet_to_json(worksheet,{raw:true});
|
278
|
-
|
279
|
-
console.log(work);
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
var dataNo = 'data';
|
284
|
-
|
285
|
-
var tdName = 'td';
|
286
|
-
|
287
|
-
for(i=1;i<=4;i++){
|
288
|
-
|
289
|
-
$('.' + dataNo+i).find('.na').text(work[i].__EMPTY_1);
|
290
|
-
|
291
|
-
$('.' + dataNo+i).find('.' + tdName+5).text(work[i].__EMPTY_5);
|
292
|
-
|
293
|
-
$('.' + dataNo+i).find('.' + tdName+6).text(work[i].__EMPTY_6);
|
294
|
-
|
295
|
-
$('.' + dataNo+i).find('.' + tdName+7).text(work[i].__EMPTY_7);
|
296
|
-
|
297
|
-
$('.' + dataNo+i).find('.' + tdName+8).text(work[i].__EMPTY_8);
|
298
|
-
|
299
|
-
$('.' + dataNo+i).find('.' + tdName+9).text(work[i].__EMPTY_9);
|
300
|
-
|
301
|
-
$('.' + dataNo+i).find('.' + tdName+10).text(work[i].__EMPTY_10);
|
302
|
-
|
303
|
-
$('.' + dataNo+i).find('.' + tdName+11).text(work[i].__EMPTY_11);
|
304
|
-
|
305
|
-
$('.' + dataNo+i).find('.' + tdName+12).text(work[i].__EMPTY_12);
|
306
|
-
|
307
|
-
$('.' + dataNo+i).find('.' + tdName+13).text(work[i].__EMPTY_13);
|
308
|
-
|
309
|
-
$('.' + dataNo+i).find('.' + tdName+14).text(work[i].__EMPTY_14);
|
310
|
-
|
311
|
-
$('.' + dataNo+i).find('.' + tdName+15).text(work[i].__EMPTY_15);
|
312
|
-
|
313
|
-
$('.' + dataNo+i).find('.' + tdName+16).text(work[i].__EMPTY_16);
|
314
|
-
|
315
|
-
$('.' + dataNo+i).find('.' + tdName+17).text(work[i].__EMPTY_17);
|
316
|
-
|
317
|
-
$('.' + dataNo+i).find('.' + tdName+18).text(work[i].__EMPTY_18);
|
318
|
-
|
319
|
-
$('.' + dataNo+i).find('.' + tdName+19).text(work[i].__EMPTY_19);
|
320
|
-
|
321
|
-
}
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
oReq.send();
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
</script>
|
332
|
-
|
333
|
-
</body>
|
334
|
-
|
335
|
-
</html>
|
336
|
-
|
337
|
-
```
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
Excelのデータは、以下のようなデータになります。
|
342
|
-
|
343
|
-
![![イメージ説明](d305c17cdb17b627428f7021ba420816.png)](d9cfd3258607160de8f6d7bab9b15408.png)
|
1
コードと画像追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -29,3 +29,315 @@
|
|
29
29
|
|
30
30
|
|
31
31
|
お力添えいただけると幸いです。
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
【追記】
|
40
|
+
|
41
|
+
無駄な部分も多いかと思いますが・・・
|
42
|
+
|
43
|
+
xlsxファイルをなんとか表示できるようになりました。
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
ただ、
|
48
|
+
|
49
|
+
$('.' + dataNo+i).find('.na').text(work[i].__EMPTY_1);
|
50
|
+
|
51
|
+
$('.' + dataNo+i).find('.' + tdName+5).text(work[i].__EMPTY_5);
|
52
|
+
|
53
|
+
$('.' + dataNo+i).find('.' + tdName+6).text(work[i].__EMPTY_6);
|
54
|
+
|
55
|
+
$('.' + dataNo+i).find('.' + tdName+7).text(work[i].__EMPTY_7);
|
56
|
+
|
57
|
+
$('.' + dataNo+i).find('.' + tdName+8).text(work[i].__EMPTY_8);
|
58
|
+
|
59
|
+
の部分が、まとめれたらなとも感じております。
|
60
|
+
|
61
|
+
以下がコードです。
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
```html
|
66
|
+
|
67
|
+
<!DOCTYPE html>
|
68
|
+
|
69
|
+
<html lang="ja">
|
70
|
+
|
71
|
+
<head>
|
72
|
+
|
73
|
+
<meta charset="unicode">
|
74
|
+
|
75
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.14.1/xlsx.full.min.js"></script>
|
76
|
+
|
77
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
|
78
|
+
|
79
|
+
<title>サンプル</title>
|
80
|
+
|
81
|
+
</head>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
<body>
|
86
|
+
|
87
|
+
<h1>サンプル</h1>
|
88
|
+
|
89
|
+
<table>
|
90
|
+
|
91
|
+
<tr class="data1">
|
92
|
+
|
93
|
+
<td class="na"></td>
|
94
|
+
|
95
|
+
<td class="td5"></td>
|
96
|
+
|
97
|
+
<td class="td6"></td>
|
98
|
+
|
99
|
+
<td class="td7"></td>
|
100
|
+
|
101
|
+
<td class="td8"></td>
|
102
|
+
|
103
|
+
<td class="td9"></td>
|
104
|
+
|
105
|
+
<td class="td10"></td>
|
106
|
+
|
107
|
+
<td class="td11"></td>
|
108
|
+
|
109
|
+
<td class="td12"></td>
|
110
|
+
|
111
|
+
<td class="td13"></td>
|
112
|
+
|
113
|
+
<td class="td14"></td>
|
114
|
+
|
115
|
+
<td class="td15"></td>
|
116
|
+
|
117
|
+
<td class="td16"></td>
|
118
|
+
|
119
|
+
<td class="td17"></td>
|
120
|
+
|
121
|
+
<td class="td18"></td>
|
122
|
+
|
123
|
+
<td class="td19"></td>
|
124
|
+
|
125
|
+
</tr>
|
126
|
+
|
127
|
+
<tr class="data2">
|
128
|
+
|
129
|
+
<td class="na"></td>
|
130
|
+
|
131
|
+
<td class="td5"></td>
|
132
|
+
|
133
|
+
<td class="td6"></td>
|
134
|
+
|
135
|
+
<td class="td7"></td>
|
136
|
+
|
137
|
+
<td class="td8"></td>
|
138
|
+
|
139
|
+
<td class="td9"></td>
|
140
|
+
|
141
|
+
<td class="td10"></td>
|
142
|
+
|
143
|
+
<td class="td11"></td>
|
144
|
+
|
145
|
+
<td class="td12"></td>
|
146
|
+
|
147
|
+
<td class="td13"></td>
|
148
|
+
|
149
|
+
<td class="td14"></td>
|
150
|
+
|
151
|
+
<td class="td15"></td>
|
152
|
+
|
153
|
+
<td class="td16"></td>
|
154
|
+
|
155
|
+
<td class="td17"></td>
|
156
|
+
|
157
|
+
<td class="td18"></td>
|
158
|
+
|
159
|
+
<td class="td19"></td>
|
160
|
+
|
161
|
+
</tr>
|
162
|
+
|
163
|
+
<tr class="data3">
|
164
|
+
|
165
|
+
<td class="na"></td>
|
166
|
+
|
167
|
+
<td class="td5"></td>
|
168
|
+
|
169
|
+
<td class="td6"></td>
|
170
|
+
|
171
|
+
<td class="td7"></td>
|
172
|
+
|
173
|
+
<td class="td8"></td>
|
174
|
+
|
175
|
+
<td class="td9"></td>
|
176
|
+
|
177
|
+
<td class="td10"></td>
|
178
|
+
|
179
|
+
<td class="td11"></td>
|
180
|
+
|
181
|
+
<td class="td12"></td>
|
182
|
+
|
183
|
+
<td class="td13"></td>
|
184
|
+
|
185
|
+
<td class="td14"></td>
|
186
|
+
|
187
|
+
<td class="td15"></td>
|
188
|
+
|
189
|
+
<td class="td16"></td>
|
190
|
+
|
191
|
+
<td class="td17"></td>
|
192
|
+
|
193
|
+
<td class="td18"></td>
|
194
|
+
|
195
|
+
<td class="td19"></td>
|
196
|
+
|
197
|
+
</tr>
|
198
|
+
|
199
|
+
<tr class="data4">
|
200
|
+
|
201
|
+
<td class="na"></td>
|
202
|
+
|
203
|
+
<td class="td5"></td>
|
204
|
+
|
205
|
+
<td class="td6"></td>
|
206
|
+
|
207
|
+
<td class="td7"></td>
|
208
|
+
|
209
|
+
<td class="td8"></td>
|
210
|
+
|
211
|
+
<td class="td9"></td>
|
212
|
+
|
213
|
+
<td class="td10"></td>
|
214
|
+
|
215
|
+
<td class="td11"></td>
|
216
|
+
|
217
|
+
<td class="td12"></td>
|
218
|
+
|
219
|
+
<td class="td13"></td>
|
220
|
+
|
221
|
+
<td class="td14"></td>
|
222
|
+
|
223
|
+
<td class="td15"></td>
|
224
|
+
|
225
|
+
<td class="td16"></td>
|
226
|
+
|
227
|
+
<td class="td17"></td>
|
228
|
+
|
229
|
+
<td class="td18"></td>
|
230
|
+
|
231
|
+
<td class="td19"></td>
|
232
|
+
|
233
|
+
</tr>
|
234
|
+
|
235
|
+
</table>
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
<script>
|
240
|
+
|
241
|
+
var url = "testdata.xlsx";
|
242
|
+
|
243
|
+
var oReq = new XMLHttpRequest();
|
244
|
+
|
245
|
+
oReq.open("GET", url, true);
|
246
|
+
|
247
|
+
oReq.setRequestHeader('Pragma', 'no-cache');
|
248
|
+
|
249
|
+
oReq.setRequestHeader('Cache-Control', 'no-cache');
|
250
|
+
|
251
|
+
oReq.setRequestHeader('If-Modified-Since', 'Thu, 01 Jun 1970 00:00:00 GMT');
|
252
|
+
|
253
|
+
oReq.responseType = "arraybuffer";
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
oReq.onload = function(e) {
|
258
|
+
|
259
|
+
var arraybuffer = oReq.response;
|
260
|
+
|
261
|
+
var data = new Uint8Array(arraybuffer);
|
262
|
+
|
263
|
+
var arr = new Array();
|
264
|
+
|
265
|
+
for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
|
266
|
+
|
267
|
+
var bstr = arr.join("");
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
var workbook = XLSX.read(bstr, {type:"binary"});
|
272
|
+
|
273
|
+
var first_sheet_name = workbook.SheetNames[0];
|
274
|
+
|
275
|
+
var worksheet = workbook.Sheets[first_sheet_name];
|
276
|
+
|
277
|
+
work =XLSX.utils.sheet_to_json(worksheet,{raw:true});
|
278
|
+
|
279
|
+
console.log(work);
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
var dataNo = 'data';
|
284
|
+
|
285
|
+
var tdName = 'td';
|
286
|
+
|
287
|
+
for(i=1;i<=4;i++){
|
288
|
+
|
289
|
+
$('.' + dataNo+i).find('.na').text(work[i].__EMPTY_1);
|
290
|
+
|
291
|
+
$('.' + dataNo+i).find('.' + tdName+5).text(work[i].__EMPTY_5);
|
292
|
+
|
293
|
+
$('.' + dataNo+i).find('.' + tdName+6).text(work[i].__EMPTY_6);
|
294
|
+
|
295
|
+
$('.' + dataNo+i).find('.' + tdName+7).text(work[i].__EMPTY_7);
|
296
|
+
|
297
|
+
$('.' + dataNo+i).find('.' + tdName+8).text(work[i].__EMPTY_8);
|
298
|
+
|
299
|
+
$('.' + dataNo+i).find('.' + tdName+9).text(work[i].__EMPTY_9);
|
300
|
+
|
301
|
+
$('.' + dataNo+i).find('.' + tdName+10).text(work[i].__EMPTY_10);
|
302
|
+
|
303
|
+
$('.' + dataNo+i).find('.' + tdName+11).text(work[i].__EMPTY_11);
|
304
|
+
|
305
|
+
$('.' + dataNo+i).find('.' + tdName+12).text(work[i].__EMPTY_12);
|
306
|
+
|
307
|
+
$('.' + dataNo+i).find('.' + tdName+13).text(work[i].__EMPTY_13);
|
308
|
+
|
309
|
+
$('.' + dataNo+i).find('.' + tdName+14).text(work[i].__EMPTY_14);
|
310
|
+
|
311
|
+
$('.' + dataNo+i).find('.' + tdName+15).text(work[i].__EMPTY_15);
|
312
|
+
|
313
|
+
$('.' + dataNo+i).find('.' + tdName+16).text(work[i].__EMPTY_16);
|
314
|
+
|
315
|
+
$('.' + dataNo+i).find('.' + tdName+17).text(work[i].__EMPTY_17);
|
316
|
+
|
317
|
+
$('.' + dataNo+i).find('.' + tdName+18).text(work[i].__EMPTY_18);
|
318
|
+
|
319
|
+
$('.' + dataNo+i).find('.' + tdName+19).text(work[i].__EMPTY_19);
|
320
|
+
|
321
|
+
}
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
oReq.send();
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
</script>
|
332
|
+
|
333
|
+
</body>
|
334
|
+
|
335
|
+
</html>
|
336
|
+
|
337
|
+
```
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
Excelのデータは、以下のようなデータになります。
|
342
|
+
|
343
|
+
![![イメージ説明](d305c17cdb17b627428f7021ba420816.png)](d9cfd3258607160de8f6d7bab9b15408.png)
|