미채택 완료

엑셀 파일 모바일 출력

2022-11-28 (월) 10:09:08 2,266

게시글을 엑셀로 다운받아서 보고 있는데

PC에서는 문제가 없는데 모바일에서는 한글이 깨져보입니다.

PC MOBILE 같은 php파일로 다운받고 있고

해당 파일에서 직접다운받아도 한글이 깨지고

pc에서 받아서 한글 출력이 정상적으로 되는 걸 확인한 파일을 카톡이나 메일로 보내서 모바일에서 확인해도 그렇습니다.

검색해서 나온 방법중에서는 유의미한 변화가 없었습니다.

아래는 다운로드 파일 전문입니다.

혹시 참고할만한 내용이 있을까요?

Copy
<?php
include_once('./_common.php');

if ($is_admin != 'super') {
    alert('권한이 없습니다.');
}

if (!$bo_table) {
    alert('bo_table 값이 없습니다.');
}

if (!$wr_id) {
    alert('wr_id 값이 없습니다.');
}

$tmp_write_table = $g5['write_prefix'] . $bo_table;
$sql = " select * from {$tmp_write_table} where wr_parent = '$wr_id' and wr_is_comment = 1 order by wr_datetime ";
$result = sql_query($sql);

$cnt = @sql_num_rows($result);
if (!$cnt) {
    alert("출력할 내역이 없습니다.");
} else {

    /*================================================================================
    php_writeexcel http://www.bettina-attack.de/jonny/view.php/projects/php_writeexcel/
    =================================================================================*/

    include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_workbook.inc.php');
    include_once(G5_LIB_PATH.'/Excel/php_writeexcel/class.writeexcel_worksheet.inc.php');

    $fname = tempnam(G5_DATA_PATH, "tmp-orderlist.xls");
    $workbook = new writeexcel_workbook($fname);
    $worksheet = $workbook->addworksheet();
    $worksheet->set_column('A:E', 25);

    // Put Excel data
    $data = array('첫번째', '두번째', '세번째', '네번째', '다섯번째', ' ');
    $data = array_map('iconv_euckr', $data);
    

    $col = 0;
    foreach($data as $cell) {
        $worksheet->write(0, $col++, $cell);
    }

    $save_it_id = '';
    for($i=1; $row=sql_fetch_array($result); $i++)
    {
        $row = array_map('iconv_euckr', $row);
        $worksheet->write($i, 0, $row['wr_1']);
        $worksheet->write($i, 1, $row['wr_9']);
        $worksheet->write($i, 2, $row['wr_2']);
        $worksheet->write($i, 3, $row['wr_3']);
        $worksheet->write($i, 4, $row['wr_4']);
    }

    $workbook->close();

    header( "Content-type: application/vnd.ms-excel;charset=UTF-8");
    header( "Expires: 0" );
    header( "Cache-Control: must-revalidate, post-check=0,pre-check=0" );
    header("name=\"file-".date("ymd", time()).".xls\"");
    header("Content-Disposition: inline; filename=\"file-".date("ymd", time()).".xls\"");

    $fh=fopen($fname, "rb");
    fpassthru($fh);
    unlink($fname);

    exit;
}
?>

답변 1개 / 댓글 1개

답변에 대한 댓글 1개

네 그렇습니다 ㅠㅠ 뭔가 문제인지 모르겠네요 답변감사합니다!

답변을 작성하려면 로그인이 필요합니다.