Example #1
0
if (isset($_GET['providers'])) {
    $providers = urlencode($_GET['providers']);
}
//언론사 필터링
$unit = "1";
if (isset($_GET['unit'])) {
    $unit = $_GET['unit'];
    //출력 날짜 범위
}
//http://147.47.123.2:9999/NSNA_ExpertFrontEnd/JSP/DownloadExcel.jsp?keyword=%EA%B7%BC%ED%98%9C&begin=20130601&end=20130614&providers=%EA%B2%BD%EC%9D%B8%EC%9D%BC%EB%B3%B4&unit=7
//$url = "http://147.47.123.2:8080/NSNA_ExpertFrontEnd/JSP/DownloadExcel.jsp?keyword=".$keyword."&begin=".$begin."&end=".$end."&type=second&providers=".$providers."&unit=".$unit;
$url = "http://147.47.125.161:9999/NSNA_FrontEnd/JSP/DownloadExcel.jsp?keyword=" . $keyword . "&period=" . $period . "&begin=" . $begin . "&end=" . $end . "&type=second&providers=" . $providers . "&unit=" . $unit;
$xml = simplexml_load_file($url);
foreach ($xml->UNIT as $unit_child) {
    $active_sheet = $objPHPExcel->setActiveSheetIndex(0)->setTitle('Degree');
    $row_num = 1;
    foreach ($unit_child->DEGREE->children() as $child) {
        $child_name = $child->getName();
        $cellNum = 0;
        foreach ($child as $key => $value) {
            $active_sheet->setCellValueByColumnAndRow($cellNum, $row_num, trim_str($value));
            $cellNum += 1;
        }
        $row_num += 1;
    }
    break;
}
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Example #2
0
$unit = $end_date->diff($begin_date)->days;
$url = "http://147.47.125.161:9999/NSNA_FrontEnd/JSP/DownloadExcel.jsp?keyword=" . $keyword . "&begin=" . $begin . "&end=" . $end . "&type=first&providers=" . $providers . "&unit=" . $unit;
$xml = simplexml_load_file($url);
//$xml=simplexml_load_file("example.xml");
foreach ($xml->UNIT as $unit_child) {
    $active_sheet = $objPHPExcel->setActiveSheetIndex(0)->setTitle('Reference');
    $row_num = 2;
    $active_sheet->setCellValue('A1', 'INFOSRC_NAME')->setCellValue('B1', 'INFOSRC_ORG')->setCellValue('C1', 'INFOSRC_CODE')->setCellValue('D1', 'INFOSRC_POS')->setCellValue('E1', 'STN_CONTENT')->setCellValue('F1', 'ART_ID')->setCellValue('G1', 'ART_DATE')->setCellValue('H1', 'ART_PROVIDER');
    foreach ($unit_child->REFERENCE->children() as $child) {
        $child_name = $child->getName();
        if ($child_name == "STN") {
            $active_sheet->setCellValueByColumnAndRow(0, $row_num, trim_str($child->INFOSRC_NAME));
            $active_sheet->setCellValueByColumnAndRow(1, $row_num, trim_str($child->INFOSRC_ORG));
            $active_sheet->setCellValueByColumnAndRow(2, $row_num, trim_str($child->INFOSRC_CODE));
            $active_sheet->setCellValueByColumnAndRow(3, $row_num, trim_str($child->INFOSRC_POS));
            $active_sheet->setCellValueByColumnAndRow(4, $row_num, trim_str($child->STN_CONTENT));
            $active_sheet->setCellValueByColumnAndRow(5, $row_num, trim_str($child->ART_ID));
            $active_sheet->setCellValueByColumnAndRow(6, $row_num, trim_str($child->ART_DATE));
            $active_sheet->setCellValueByColumnAndRow(7, $row_num, trim_str($child->ART_PROVIDER));
            $row_num += 1;
        }
    }
    break;
}
$active_sheet = $objPHPExcel->createSheet()->setTitle('Query_Info');
$row_num = 2;
$active_sheet->setCellValue('A1', 'QUERY')->setCellValue('B1', 'BEGIN')->setCellValue('C1', 'END')->setCellValue('D1', 'PROVIDERS')->setCellValue('A2', urldecode($keyword))->setCellValue('B2', $begin)->setCellValue('C2', $end)->setCellValue('D2', urldecode($providers));
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Example #3
0
                $active_sheet->setCellValueByColumnAndRow(2, $row_num, trim_str($child->ART_ID));
                $row_num += 1;
            }
        }
    }
    $active_sheet = $objPHPExcel->createSheet()->setTitle('Article');
    $row_num = 2;
    $active_sheet->setCellValue('A1', 'ART_ID')->setCellValue('B1', 'ART_HEADLINE')->setCellValue('C1', 'ART_DATE')->setCellValue('D1', 'ART_PROVIDER')->setCellValue('E1', 'ART_CONTENT');
    foreach ($unit_child->ARTICLE->children() as $child) {
        $child_name = $child->getName();
        if ($child_name == "ART_CTR") {
        } else {
            if ($child_name == "ART") {
                $active_sheet->setCellValueByColumnAndRow(0, $row_num, trim_str($child->ART_ID));
                $active_sheet->setCellValueByColumnAndRow(1, $row_num, trim_str($child->ART_HEADLINE));
                $active_sheet->setCellValueByColumnAndRow(2, $row_num, trim_str($child->ART_DATE));
                $active_sheet->setCellValueByColumnAndRow(3, $row_num, trim_str($child->ART_PROVIDER));
                $active_sheet->setCellValueByColumnAndRow(4, $row_num, trim_str($child->ART_CONTENT));
                $row_num += 1;
            }
        }
    }
    break;
}
$active_sheet = $objPHPExcel->createSheet()->setTitle('Query_Info');
$row_num = 2;
$active_sheet->setCellValue('A1', 'QUERY')->setCellValue('B1', 'BEGIN')->setCellValue('C1', 'END')->setCellValue('D1', 'PROVIDERS')->setCellValue('A2', urldecode($keyword))->setCellValue('B2', $begin)->setCellValue('C2', $end)->setCellValue('D2', urldecode($providers));
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
Example #4
0
$xml = simplexml_load_file($url);
//$xml=simplexml_load_file("example.xml");
foreach ($xml->UNIT as $unit_child) {
    $active_sheet = $objPHPExcel->setActiveSheetIndex(0)->setTitle('Article');
    $row_num = 2;
    $active_sheet->setCellValue('A1', 'ART_ID')->setCellValue('B1', 'ART_CATEGORY')->setCellValue('C1', 'ART_HEADLINE')->setCellValue('D1', 'ART_DATE')->setCellValue('E1', 'ART_PROVIDER')->setCellValue('F1', 'ART_CONTENT');
    foreach ($unit_child->ARTICLE->children() as $child) {
        $child_name = $child->getName();
        if ($child_name == "ART") {
            $active_sheet->setCellValueByColumnAndRow(0, $row_num, trim_str($child->ART_ID));
            $active_sheet->setCellValueByColumnAndRow(1, $row_num, trim_str($child->ART_CATEGORY));
            $active_sheet->setCellValueByColumnAndRow(2, $row_num, trim_str($child->ART_HEADLINE));
            $active_sheet->setCellValueByColumnAndRow(3, $row_num, trim_str($child->ART_DATE));
            $active_sheet->setCellValueByColumnAndRow(4, $row_num, trim_str($child->ART_PROVIDER));
            $contents = "";
            foreach ($child->ART_CONTENT->children() as $content) {
                $contents .= trim_str($content);
            }
            $active_sheet->setCellValueByColumnAndRow(5, $row_num, trim_str($contents));
            $row_num += 1;
        }
    }
    break;
}
$active_sheet = $objPHPExcel->createSheet()->setTitle('Query_Info');
$row_num = 2;
$active_sheet->setCellValue('A1', 'QUERY')->setCellValue('B1', 'BEGIN')->setCellValue('C1', 'END')->setCellValue('D1', 'PROVIDERS')->setCellValue('A2', urldecode($keyword))->setCellValue('B2', $begin)->setCellValue('C2', $end)->setCellValue('D2', urldecode($providers));
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;