/home/mjc1/public_html/j3demo/xls_write2.php


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
<?php
include("./_common.php");

$f1['fname'] = "추가_베트남2F_E52 T-FOG_TOUCH번역.xls";
$f1['rows'] = 8;
$f1['cols'] = 3869;
$xls_file[] = $f1;

$f2['fname'] = "추가_베트남2F_E52_COF_TOUCH번역.xls";
$f2['rows'] = 11;
$f2['cols'] = 4569;
$xls_file[] = $f2;

$f3['fname'] = "추가_베트남2F_E52_FOF_TOUCH번역.xls";
$f3['rows'] = 8;
$f3['cols'] = 3960;
$xls_file[] = $f3;

$idx 2;

$sql "select xls_alpha from xls_reader where xls_file = '{$idx}' and xls_left2 <> '' group by xls_alpha";
$res mysql_query($sql,$connect_j3);
while(
$info=mysql_fetch_array($res)){
    
$alpha_array[] = $info;
}

$sql "select * from xls_reader where xls_file = '{$idx}' and xls_left2 <> '' order by xls_no, xls_alpha ";
$res mysql_query($sql,$connect_j3);

while(
$info=mysql_fetch_array($res)){
    
$info_array[] = $info;
}

require_once 
$j3_lib_path."/phpexcel/PHPExcel.php";

$objPHPExcel = new PHPExcel();

foreach(
$alpha_array as $key=>$info){
    
$alpha chr(64+$info['xls_alpha']);
    
$objPHPExcel->getActiveSheet()->getColumnDimension($alpha)->setAutoSize(true);
}

$cnt=0$update_cnt 0;
foreach(
$info_array as $key=>$info){
    
$alpha chr(64+$info['xls_alpha']);
    
//$objPHPExcel->setActiveSheetIndex(0)->getRowDimension($info['xls_no'])->setRowHeight(21);
    
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($alpha.$info['xls_no'], $info['xls_left2']);
}


$objPHPExcel->getActiveSheet()->setTitle('번역리스트');
$objPHPExcel->setActiveSheetIndex(0);

// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.$xls_file[$idx]['fname'].'"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');

// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0

$objWriter PHPExcel_IOFactory::createWriter($objPHPExcel'Excel5');
$objWriter->save('php://output');
?>