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
|
<?php include("./_common.php");
echo "막혔음"; exit;
$f1['fname'] = "./data/khh-CWA Inspection Language 요청 190918-1.xls"; $f1['sheet'][0]['name'] = '255'; $f1['sheet'][0]['rows'] = 1; $f1['sheet'][0]['cols'] = 1387; $f1['sheet'][1]['name'] = '256'; $f1['sheet'][1]['rows'] = 1; $f1['sheet'][1]['cols'] = 3031; $f1['sheet'][2]['name'] = '257'; $f1['sheet'][2]['rows'] = 1; $f1['sheet'][2]['cols'] = 637; $f1['sheet'][3]['name'] = '258'; $f1['sheet'][3]['rows'] = 1; $f1['sheet'][3]['cols'] = 442; $xls_file[] = $f1;
$f2['fname'] = "./data/khh-CWA Stacking Language 요청 190918-1.xls"; $f2['sheet'][0]['name'] = '3'; $f2['sheet'][0]['rows'] = 1; $f2['sheet'][0]['cols'] = 1856; $f2['sheet'][1]['name'] = '255'; $f2['sheet'][1]['rows'] = 1; $f2['sheet'][1]['cols'] = 978; $f2['sheet'][2]['name'] = '256'; $f2['sheet'][2]['rows'] = 1; $f2['sheet'][2]['cols'] = 2959; $f2['sheet'][3]['name'] = '257'; $f2['sheet'][3]['rows'] = 1; $f2['sheet'][3]['cols'] = 103;
$xls_file[] = $f2;
$f3['fname'] = "./data/khh-CWA Taping Language 요청 190918-2.xls"; $f3['sheet'][0]['name'] = '3'; $f3['sheet'][0]['rows'] = 1; $f3['sheet'][0]['cols'] = 895; $f3['sheet'][1]['name'] = '254'; $f3['sheet'][1]['rows'] = 1; $f3['sheet'][1]['cols'] = 7985; $f3['sheet'][2]['name'] = '255'; $f3['sheet'][2]['rows'] = 1; $f3['sheet'][2]['cols'] = 2972; $f3['sheet'][3]['name'] = '256'; $f3['sheet'][3]['rows'] = 1; $f3['sheet'][3]['cols'] = 291; $f3['sheet'][4]['name'] = '257'; $f3['sheet'][4]['rows'] = 1; $f3['sheet'][4]['cols'] = 711; $f3['sheet'][5]['name'] = '258'; $f3['sheet'][5]['rows'] = 1; $f3['sheet'][5]['cols'] = 910; $xls_file[] = $f3;
$f4['fname'] = "./data/khh-CWA Unloader Language 요청 190918-1.xls"; $f4['sheet'][0]['name'] = '255'; $f4['sheet'][0]['rows'] = 1; $f4['sheet'][0]['cols'] = 889; $f4['sheet'][1]['name'] = '256'; $f4['sheet'][1]['rows'] = 1; $f4['sheet'][1]['cols'] = 649; $xls_file[] = $f4;
include_once($j3_lib_path.'/Excel/reader.php');
for($x=0;$x<count($xls_file);$x++){ //if($x==0 || $x==2 || $x==3){ continue; } $f_idx = $x; $file = $xls_file[$f_idx]['fname']; //_pr($file);
$data = new Spreadsheet_Excel_Reader(); // Set output Encoding. $data->setOutputEncoding('UTF-8'); $data->read($file);
$sql = "delete from xls_reader where xls_file = '$f_idx' "; mysql_query($sql,$connect_j3);
echo $data->sheets[0]['cells'][2][2];
foreach($xls_file[$f_idx]['sheet'] as $key=>$sheets){ //_pr($key); $rows = $sheets['rows']; $cols =$sheets['cols'];
$cnt = 0; for($i=1;$i<=$cols;$i++){ for($j=1;$j<=$rows;$j++){ $code = addslashes($data->sheets[$key]['cells'][$i][$j]); if($code!=''){ $sql = "insert into xls_reader set xls_file = '{$f_idx}', xls_alpha = '{$j}', xls_no = '{$i}', xls_sheet = '{$key}', xls_content = '{$code}' "; //_pr($sql); mysql_query($sql,$connect_j3); }
//if($cnt==100){ exit; } $cnt++; } } } }
?>
|