예제 #1
0
파일: sht_config.php 프로젝트: sohgo/faxocr
function put_excel($xls, $marker_window, $sheet_marker, $field_index, &$conf, $debug_mode)
{
    $sid = sprintf("%05d", $conf->get("sid"));
    $cid = strtok($conf->get("candidate_code"), "-");
    // シート表示
    // for ($sn = 0; $sn < 1; $sn++) {
    $sn = 0;
    while ($cid != FALSE) {
        $cid = sprintf("%05d", $cid);
        // 調査シートHTML
        $html .= "\n<hr style=\"page-break-after:always; visibility:hidden;\" />\n\n";
        $html .= "<div id=\"ex3\" class=\"jqDnR\" style=\"z-index: 3; position: relative; width: " . $sheet_marker->disp_sheet->marker_window->width . "px; height: " . $sheet_marker->disp_sheet->marker_window->height . "px; font-size: 12px; padding: 0px; border: 0px; margin: 0px; \">\n";
        // marker: top - left
        $html .= "<img src=\"/home/faxocr/etc/mark.gif\" class=\"mark-img\" alt=\"marker\" style=\"position: absolute; top: " . $sheet_marker->disp_sheet->marker_window->topLeftMarker->position_y . "px; left: " . $sheet_marker->disp_sheet->marker_window->topLeftMarker->position_x . "px; width: " . $sheet_marker->disp_sheet->marker_window->topLeftMarker->width . "px; height: " . $sheet_marker->disp_sheet->marker_window->topLeftMarker->height . "px; z-index: 100; \" />";
        // sheet ID: top
        $html .= "<div style=\"position: absolute; top: " . $sheet_marker->disp_sheet->marker_window->topLeftMarker->position_y . "px; left: " . $sheet_marker->disp_sheet->marker_window->position_of_sheet_id_from_left_side . "px; z-index: 100; \"><font style=\"line-height: " . $sheet_marker->disp_sheet->size_of_marker * 0.9 . "px; font-size: " . $sheet_marker->disp_sheet->size_of_marker * 0.9 . "px; font-family: 'OCRB'; \">" . $cid . "</font></div>\n";
        // marker: top - right
        $html .= "<img src=\"/home/faxocr/etc/mark.gif\" class=\"mark-img\" alt=\"marker\" style=\"position: absolute; top: " . $sheet_marker->disp_sheet->marker_window->topRightMarker->position_y . "px; left: " . $sheet_marker->disp_sheet->marker_window->topRightMarker->position_x . "px; width: " . $sheet_marker->disp_sheet->size_of_marker . "px; height: " . $sheet_marker->disp_sheet->size_of_marker . "px; z-index: 100; \" />\n";
        // marker: bottom - left
        $html .= "<img src=\"/home/faxocr/etc/mark.gif\" class=\"mark-img\" alt=\"marker\" style=\"position: absolute; bottom: 0px; left: " . $sheet_marker->disp_sheet->marker_window->bottomLeftMarker->position_y . "px; width: " . $sheet_marker->disp_sheet->marker_window->bottomLeftMarker->width . "px; height: " . $sheet_marker->disp_sheet->marker_window->bottomLeftMarker->height . "px; z-index: 100; \" />";
        // sheet ID: bottom
        $html .= "<div style=\"position: absolute; bottom: 0px; left: " . $sheet_marker->disp_sheet->marker_window->position_of_sheet_id_from_left_side . "px; z-index: 100; \"><font style=\"line-height: " . $sheet_marker->disp_sheet->size_of_marker * 0.9 . "px; font-size: " . $sheet_marker->disp_sheet->size_of_marker * 0.9 . "px; font-family: 'OCRB'; \">" . $sid . "</font></div>\n";
        $cid = strtok("-");
        // debug
        /*
        		$html .= "<div style='position: relative; z-index: 100;'>";
        		$html .= "scale: " . $sheet_marker->scale . "<br />";
        		$html .= "marker_scale: " . $sheet_marker->marker_scale . "<br />";
        		$html .= "tablewidth: " . $sheet_marker->disp_sheet->tblwidth . "<br />";
        		$html .= "tableheight: " . $sheet_marker->disp_sheet->tblheight . "<br />";
        		$html .= "row: " . $sheet_marker->row_count . "<br />";
        		$html .= "row_size(1): " . $sheet_marker->get_row_size(1) . "<br />";
        		$html .= "sheet_width: " . $sheet_marker->disp_sheet->sheet_width . "<br />";
        		$html .= "sheet_height: " . $sheet_marker->disp_sheet->sheet_height . "<br />";
        		$html .= "marker_offset_x: " . $sheet_marker->disp_sheet->marker_offset_x . "<br />";
        		$html .= "marker_offset_y: " . $sheet_marker->disp_sheet->marker_offset_y . "<br />";
        		$html .= "size_of_marker: " . $sheet_marker->disp_sheet->size_of_marker . "<br />";
        		$html .= "position_of_sheet_id_from_left_side: " . $sheet_marker->disp_sheet->position_of_sheet_id_from_left_side . "<br />";
        		$html .= "position_top_marker: " . $sheet_marker->disp_sheet->position_top_marker . "<br />";
        		$html .= "position_left_marker: " . $sheet_marker->disp_sheet->position_left_marker . "<br />";
        		$html .= "position_bottom_marker: " . $sheet_marker->disp_sheet->position_bottom_marker . "<br />";
        		$html .= "position_right_marker: " . $sheet_marker->disp_sheet->position_right_marker . "<br />";
        		$html .= "</div>";
        */
        // シートテーブル表示
        $html .= "<table class=\"sheet\" border=\"0\" cellpadding=\"0\"";
        $html .= " cellspacing=\"0\"";
        $html .= " width=\"" . $sheet_marker->disp_sheet->sheetOnHtmlTable->width . "px\" height=\"" . $sheet_marker->disp_sheet->sheetOnHtmlTable->height . "px\"";
        $html .= " style=\"table-layout: fixed; border-collapse: collapse; position: absolute; top: 0px; left: 0px; z-index: 10; \"";
        $html .= " bgcolor=\"#FFFFFF\" >\n";
        // table-layout: fixed の場合、<table>の最初の行のセル幅で幅が決まる。
        // 最初の行にcolspanが含まれているとずれてしまうので、
        // <th>を使って定義することで以降のセル幅を決めてしまう。
        $html .= "  <tr>\n";
        foreach (range($sheet_marker->topLeftMarker->colNum, $sheet_marker->topRightMarker->colNum) as $i) {
            $thwidth = $sheet_marker->disp_sheet->sheetOnHtmlTable->get_col_size($i);
            $html .= "   <th style=\"width: {$thwidth}px; height: 0px; \"></th>\n";
        }
        $html .= "  </tr>\n";
        $min_col_no = $sheet_marker->topLeftMarker->colNum;
        $max_col_no = $sheet_marker->topRightMarker->colNum;
        $min_row_no = $sheet_marker->topLeftMarker->rowNum;
        $max_row_no = $sheet_marker->bottomLeftMarker->rowNum;
        foreach (range($sheet_marker->topLeftMarker->rowNum, $sheet_marker->bottomLeftMarker->rowNum) as $r) {
            $tdheight = $sheet_marker->disp_sheet->sheetOnHtmlTable->get_row_size($r);
            $html .= "  <tr>\n";
            foreach (range($sheet_marker->topLeftMarker->colNum, $sheet_marker->topRightMarker->colNum) as $i) {
                $tdwidth = $sheet_marker->disp_sheet->sheetOnHtmlTable->get_col_size($i);
                // hide border of the cell to which the marker is adjacent
                if ($r == $min_row_no + 1 && $i == $min_col_no + 1) {
                    $hide_border_adjacent_to_marker = "border-top-width: 0px; border-left-width: 0px;";
                } else {
                    if ($r == $min_row_no + 1 && $i == $max_col_no - 1) {
                        $hide_border_adjacent_to_marker = "border-top-width: 0px; border-right-width: 0px;";
                    } else {
                        if ($r == $max_row_no - 1 && $i == $min_col_no + 1) {
                            $hide_border_adjacent_to_marker = "border-bottom-width: 0px; border-left-width: 0px;";
                        } else {
                            $hide_border_adjacent_to_marker = "";
                        }
                    }
                }
                $hide_border_adjacent_to_marker = "";
                // currently this feature is disabled
                $dispval = $xls->dispcell($sn, $r, $i);
                $dispval = strconv($dispval);
                if (isset($xls->hlink[$sn][$r][$i])) {
                    $dispval = "<a href=\"" . $xls->hlink[$sn][$r][$i] . "\">" . $dispval . "</a>";
                }
                $xf = $xls->getAttribute($sn, $r, $i);
                if (isset($xf['wrap']) && $xf['wrap']) {
                    $dispval = preg_replace('/\\n/', '<br />', $dispval);
                }
                $xfno = $xf['xf'] > 0 ? $xf['xf'] : 0;
                $align = "x";
                if (isset($xf['halign']) && $xf['halign'] != 0) {
                    $align = "";
                }
                if ($align == "x") {
                    if ($xf['type'] == Type_RK) {
                        $align = " align=\"right\"";
                    } else {
                        if ($xf['type'] == Type_RK2) {
                            $align = " align=\"right\"";
                        } else {
                            if ($xf['type'] == Type_NUMBER) {
                                $align = " align=\"right\"";
                            } else {
                                if ($xf['type'] == Type_FORMULA && is_numeric($dispval)) {
                                    $align = " align=\"right\"";
                                } else {
                                    if ($xf['type'] == Type_FORMULA2 && is_numeric($dispval)) {
                                        $align = " align=\"right\"";
                                    } else {
                                        if ($xf['type'] == Type_FORMULA && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                            $align = " align=\"center\"";
                                        } else {
                                            if ($xf['type'] == Type_FORMULA2 && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                                $align = " align=\"center\"";
                                            } else {
                                                if ($xf['type'] == Type_BOOLERR) {
                                                    $align = " align=\"center\"";
                                                } else {
                                                    $align = '';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if ($xf['format'] == "@") {
                        $align = "";
                    }
                } else {
                    $align = "";
                }
                if (substr($dispval, 0, 1) == "'") {
                    $dispval = substr($dispval, 1);
                }
                if (substr($dispval, 0, 6) == "&#039;") {
                    $dispval = substr($dispval, 6);
                }
                // セル表示
                $bgcolor = $xf['fillpattern'] == 1;
                $loc = $sn . "-" . $r . "-" . $i;
                if (isset($field_index[$loc])) {
                    $dispval = "";
                    if ($debug_mode === 'true') {
                        // debug for ocr test
                        $dispval = "<div style='text-align: center;'>0</div>";
                    }
                }
                if ($r == $min_row_no || $r == $max_row_no || $i == $min_col_no || $i == $max_col_no) {
                    $dispval = "";
                }
                $celattr = $xls->getAttribute($sn, $r, $i);
                $fontsize = floor($celattr["font"]["height"] * $sheet_marker->marker_scale / 16);
                $fontsize .= "px";
                if (isset($xls->celmergeinfo[$sn][$r][$i]['cond'])) {
                    if ($xls->celmergeinfo[$sn][$r][$i]['cond'] == 1) {
                        $colspan = $xls->celmergeinfo[$sn][$r][$i]['cspan'];
                        $rowspan = $xls->celmergeinfo[$sn][$r][$i]['rspan'];
                        if ($colspan > 1) {
                            $rcspan = " colspan=\"" . $colspan . "\"";
                        } else {
                            $rcspan = "";
                        }
                        if ($rowspan > 1) {
                            $rcspan .= " rowspan=\"" . $rowspan . "\"";
                        }
                        // do not apply any class to the most max or min row or column
                        if ($r == $min_row_no || $r == $max_row_no || $i == $min_col_no || $i == $max_col_no) {
                            $class = "";
                        } else {
                            $class = " class=\"XFs" . $sn . "r" . $r . "c" . $i . "\"";
                        }
                        $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                        $html .= "   <td {$class} {$rcspan} {$align} style=\"font-size: " . $fontsize . "; width: {$tdwidth}px; height: {$tdheight}px; {$hide_border} \">{$dispval}</td>\n";
                    }
                } else {
                    // do not apply any class to the most max or min row or column
                    if ($r == $min_row_no || $r == $max_row_no || $i == $min_col_no || $i == $max_col_no) {
                        $class = "";
                    } else {
                        $class = " class=\"XF" . $xfno . "\" ";
                    }
                    $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                    $html .= "   <td {$class} {$align} style=\"white-space: nowrap; font-size: " . $fontsize . "; width: {$tdwidth}px; height: {$tdheight}px; {$hide_border_adjacent_to_marker} \">{$dispval}</td>\n";
                }
            }
            $html .= "</tr>\n";
        }
        $html .= "</table>\n";
        $html .= "</div>\n";
    }
    // while ($cid != FALSE)
    return $html;
}
예제 #2
0
파일: reg_upload.php 프로젝트: sohgo/faxocr
function put_excel($xls)
{
    // will be ignored... (remove?)
    global $flag_cc, $flag_cb, $flag_bc, $flag_bb;
    // シート表示
    for ($sn = 0; $sn < $xls->sheetnum; $sn++) {
        $fnum = 0;
        $w = 32;
        if (!isset($xls->maxcell[$sn])) {
            $xls->maxcell[$sn] = 0;
        }
        for ($i = 0; $i <= $xls->maxcell[$sn]; $i++) {
            $w += $xls->getColWidth($sn, $i);
        }
        // シート毎ヘッダ表示
        $hd = $xls->getHEADER($sn);
        $ft = $xls->getFOOTER($sn);
        if ($hd !== null) {
            $hd["left"] = isset($hd["left"]) ? strconv($hd["left"]) : "";
            $hd["center"] = isset($hd["center"]) ? strconv($hd["center"]) : "";
            $hd["right"] = isset($hd["right"]) ? strconv($hd["right"]) : "";
            print <<<STR

<table width="{$w}" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC">
<tr>
\t<td width="30" nowrap><font size="1">ヘッダ</font></td>
\t<td bgcolor="#FFFFFF"><div align="left"> {$hd["left"]} </div></td>
\t<td bgcolor="#FFFFFF"><div align="center"> {$hd["center"]} </div></td>
\t<td bgcolor="#FFFFFF"><div align="right"> {$hd["right"]} </div></td>
</tr></table>
STR;
        }
        // シートテーブル表示
        print <<<STR
<table id="tablefix-{$sn}" class="sheet" border="0" cellpadding="0" cellspacing="0" width="{$w}" bgcolor="#FFFFFF" style="border-collapse: collapse;">
  <tr bgcolor="#CCCCCC">
\t<th class="XF" bgcolor="#CCCCCC" scope="col" width="32">&nbsp;</th>
STR;
        for ($i = 0; $i <= $xls->maxcell[$sn]; $i++) {
            $tdwidth = $xls->getColWidth($sn, $i);
            print "    <th class=\"XF\" bgcolor=\"#CCCCCC\" scope=\"col\" width=\"";
            print $tdwidth . "\">" . $i . "</th>" . "\n";
        }
        print "  </tr>\n";
        if (!isset($xls->maxrow[$sn])) {
            $xls->maxrow[$sn] = 0;
        }
        for ($r = 0; $r <= $xls->maxrow[$sn]; $r++) {
            print '  <tr height="' . $xls->getRowHeight($sn, $r) . '">' . "\n";
            print "   <th class=\"XF\" bgcolor=\"#CCCCCC\" scope=\"row\">" . $r . "</th>\n";
            for ($i = 0; $i <= $xls->maxcell[$sn]; $i++) {
                $tdwidth = $xls->getColWidth($sn, $i);
                $dispval = $xls->dispcell($sn, $r, $i);
                $dispval = strconv($dispval);
                if (isset($xls->hlink[$sn][$r][$i])) {
                    $dispval = "<a href=\"" . $xls->hlink[$sn][$r][$i] . "\">" . $dispval . "</a>";
                }
                $xf = $xls->getAttribute($sn, $r, $i);
                if (isset($xf["wrap"]) && $xf["wrap"]) {
                    $dispval = preg_replace("/(\r\n|\n)/", "<br />", $dispval);
                }
                $xfno = $xf["xf"] > 0 ? $xf["xf"] : 0;
                $align = "x";
                if (isset($xf["halign"]) && $xf["halign"] != 0) {
                    $align = "";
                }
                if ($align == "x") {
                    if ($xf["type"] == Type_RK) {
                        $align = " align=\"right\"";
                    } else {
                        if ($xf["type"] == Type_RK2) {
                            $align = " align=\"right\"";
                        } else {
                            if ($xf["type"] == Type_NUMBER) {
                                $align = " align=\"right\"";
                            } else {
                                if ($xf["type"] == Type_FORMULA && is_numeric($dispval)) {
                                    $align = " align=\"right\"";
                                } else {
                                    if ($xf["type"] == Type_FORMULA2 && is_numeric($dispval)) {
                                        $align = " align=\"right\"";
                                    } else {
                                        if ($xf["type"] == Type_FORMULA && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                            $align = " align=\"center\"";
                                        } else {
                                            if ($xf["type"] == Type_FORMULA2 && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                                $align = " align=\"center\"";
                                            } else {
                                                if ($xf["type"] == Type_BOOLERR) {
                                                    $align = " align=\"center\"";
                                                } else {
                                                    $align = '';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if ($xf["format"] == "@") {
                        $align = "";
                    }
                } else {
                    $align = "";
                }
                if (substr($dispval, 0, 1) == "'") {
                    $dispval = substr($dispval, 1);
                }
                if (substr($dispval, 0, 6) == "&#039;") {
                    $dispval = substr($dispval, 6);
                }
                // セル表示
                $bgcolor = $xf["fillpattern"] == 1;
                $enabled = !$header_colum && !$header_row || $header_column - 1 <= $i && $header_row - 1 <= $r;
                if (isset($xls->celmergeinfo[$sn][$r][$i]["cond"])) {
                    if ($xls->celmergeinfo[$sn][$r][$i]["cond"] == 1) {
                        $colspan = $xls->celmergeinfo[$sn][$r][$i]["cspan"];
                        $rowspan = $xls->celmergeinfo[$sn][$r][$i]["rspan"];
                        if ($colspan > 1) {
                            $rcspan = " colspan=\"" . $colspan . "\"";
                        } else {
                            $rcspan = " width=\"" . $tdwidth . "\"";
                        }
                        if ($rowspan > 1) {
                            $rcspan .= " rowspan=\"" . $rowspan . "\"";
                        }
                        $class = " class=\"XFs" . $sn . "r" . $r . "c" . $i . "\"";
                        $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                        if ($enabled && ($flag_cc && $dispval && $bgcolor || $flag_cb && $dispval && !$bgcolor || $flag_bc && !$dispval && $bgcolor || $flag_bb && !$dispval && !$bgcolor)) {
                            $name = " name=\"" . $sn . "-" . $fnum++ . "\"";
                            print " <td {$class} {$id} {$name} {$rcspan} {$align}>{$dispval}</td>\n";
                        } else {
                            print " <td {$class} {$rcspan} {$align}>{$dispval}</td>\n";
                        }
                    }
                } else {
                    $class = " class=\"XF" . $xfno . "\" ";
                    $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                    $width = "width=\"" . $tdwidth . "\" ";
                    if ($enabled && ($flag_cc && $dispval && $bgcolor || $flag_cb && $dispval && !$bgcolor || $flag_bc && !$dispval && $bgcolor || $flag_bb && !$dispval && !$bgcolor)) {
                        $name = " name=\"" . $sn . "-" . $fnum++ . "\"";
                        print " <td {$class} {$id} {$name} {$width} {$align}>{$dispval}</td>\n";
                    } else {
                        print " <td {$class} {$width} {$align}>{$dispval}</td>\n";
                    }
                }
            }
            print "</tr>\n";
        }
        print "</table>\n";
        // シートテーブル終了
        // フッタ表示
        if ($ft !== null) {
            $ft["left"] = isset($ft["left"]) ? strconv($ft["left"]) : "";
            $ft["center"] = isset($ft["center"]) ? strconv($ft["center"]) : "";
            $ft["right"] = isset($ft["right"]) ? strconv($ft["right"]) : "";
            print <<<STR
<table width="{$w}" border="0" cellpadding="0" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC"><tr>
\t<td width="30" nowrap><font size="1">フッタ</font></td>
\t<td bgcolor="#FFFFFF"><div align="left">{$ft["left"]} </div></td>
\t<td bgcolor="#FFFFFF"><div align="center">{$ft["center"]}</div></td>
\t<td bgcolor="#FFFFFF"><div align="right">{$ft["right"]}</div></td>
</tr></table>
STR;
        }
    }
}
예제 #3
0
파일: sht_marker.php 프로젝트: sohgo/faxocr
function put_excel($xls, $sheet)
{
    // シート表示
    // for ($sn = 0; $sn < 1; $sn++) {
    $sn = 0;
    // シートテーブル表示
    print "<table class=\"sheet_marker\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"";
    print $sheet->disp->tblwidth . "\" bgcolor=\"#FFFFFF\" style=\"table-layout:fixed; border-collapse: collapse;\">\n";
    print "<tr>\n";
    for ($i = 0; $i <= $sheet->col_count; $i++) {
        $tdwidth = $sheet->disp->get_col_size($i);
        print "<th height=\"0\" width=\"{$tdwidth}\"></th>";
    }
    print "\n</tr>\n";
    for ($r = 0; $r <= $sheet->row_count; $r++) {
        $trheight = $sheet->disp->get_row_size($r);
        print "  <tr height=\"" . $trheight . "\">" . "\n";
        for ($i = 0; $i <= $sheet->col_count; $i++) {
            $tdwidth = $sheet->disp->get_col_size($i);
            $dispval = $xls->dispcell($sn, $r, $i);
            $dispval = strconv($dispval);
            if (isset($xls->hlink[$sn][$r][$i])) {
                $dispval = "<a href=\"" . $xls->hlink[$sn][$r][$i] . "\">" . $dispval . "</a>";
            }
            $xf = $xls->getAttribute($sn, $r, $i);
            if (isset($xf['wrap']) && $xf['wrap']) {
                $dispval = preg_replace('/\\n/', '<br />', $dispval);
            }
            $xfno = $xf['xf'] > 0 ? $xf['xf'] : 0;
            $align = "x";
            if (isset($xf['halign']) && $xf['halign'] != 0) {
                $align = "";
            }
            if ($align == "x") {
                if ($xf['type'] == Type_RK) {
                    $align = " align=\"right\"";
                } else {
                    if ($xf['type'] == Type_RK2) {
                        $align = " align=\"right\"";
                    } else {
                        if ($xf['type'] == Type_NUMBER) {
                            $align = " align=\"right\"";
                        } else {
                            if ($xf['type'] == Type_FORMULA && is_numeric($dispval)) {
                                $align = " align=\"right\"";
                            } else {
                                if ($xf['type'] == Type_FORMULA2 && is_numeric($dispval)) {
                                    $align = " align=\"right\"";
                                } else {
                                    if ($xf['type'] == Type_FORMULA && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                        $align = " align=\"center\"";
                                    } else {
                                        if ($xf['type'] == Type_FORMULA2 && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                            $align = " align=\"center\"";
                                        } else {
                                            if ($xf['type'] == Type_BOOLERR) {
                                                $align = " align=\"center\"";
                                            } else {
                                                $align = '';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if ($xf['format'] == "@") {
                    $align = "";
                }
            } else {
                $align = "";
            }
            if (substr($dispval, 0, 1) == "'") {
                $dispval = substr($dispval, 1);
            }
            if (substr($dispval, 0, 6) == "&#039;") {
                $dispval = substr($dispval, 6);
            }
            // セル表示
            $bgcolor = $xf['fillpattern'] == 1;
            $celattr = $xls->getAttribute($sn, $r, $i);
            $fontsize = $celattr["font"]["height"] * $sheet->scale / 16;
            if (isset($xls->celmergeinfo[$sn][$r][$i]['cond'])) {
                if ($xls->celmergeinfo[$sn][$r][$i]['cond'] == 1) {
                    $colspan = $xls->celmergeinfo[$sn][$r][$i]['cspan'];
                    $rowspan = $xls->celmergeinfo[$sn][$r][$i]['rspan'];
                    if ($colspan > 1) {
                        $rcspan = " colspan=\"" . $colspan . "\"";
                    } else {
                        $rcspan = " width=\"" . $tdwidth . "\"";
                    }
                    if ($rowspan > 1) {
                        $rcspan .= " rowspan=\"" . $rowspan . "\"";
                    }
                    $class = " class=\"XFs" . $sn . "r" . $r . "c" . $i . "\"";
                    $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                    print " <td {$class} {$rcspan} {$align} style=\"font-size: " . $fontsize . "px;\">{$dispval}</td>\n";
                }
            } else {
                $class = " class=\"XF" . $xfno . "\" ";
                $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                print " <td nowrap=\"nowrap\" {$class} {$align} style=\"font-size: " . $fontsize . "px;\">{$dispval}</td>\n";
            }
        }
        print "</tr>\n";
    }
    print "</table>\n";
    // シート終了
}
예제 #4
0
파일: common.php 프로젝트: sohgo/faxocr
function put_err_page($msg)
{
    include TMP_HTML_DIR . "tpl.header.html";
    print "<blockquote><font color=\"red\"><strong>";
    print strconv($msg);
    print "</strong></font></blockquote>";
    include TMP_HTML_DIR . "tpl.footer.html";
}
예제 #5
0
파일: sht_field.php 프로젝트: sohgo/faxocr
function put_excel($xls, $sheet, &$field_list, &$field_width)
{
    // タブコントロール表示
    // print "<div class=\"simpleTabs\">";
    // print "<ul class=\"simpleTabsNavigation\">";
    // for($sn = 0; $sn < $xls->sheetnum; $sn++) {
    // 	print "<li><a href=\"#\">" .
    //	  strconv($xls->sheetname[$sn]) . "</a></li>";
    // }
    // print "</ul>";
    print "<center>";
    // シート表示
    // for ($sn = 0; $sn < $xls->sheetnum; $sn++) {
    $sn = 0;
    // シートテーブル表示
    print <<<STR
\t\t
<table class="sheet_field" border="0" cellpadding="0" cellspacing="0" width="{$sheet->disp->tblwidth}" bgcolor="#FFFFFF" style="table-layout:fixed; border-collapse: collapse;">

STR;
    print "<tr>\n";
    for ($i = 0; $i <= $sheet->col_count; $i++) {
        $tdwidth = $sheet->disp->get_col_size($i);
        print "<th height=\"0\" width=\"{$tdwidth}\"></th>";
    }
    print "\n</tr>\n";
    for ($r = 0; $r <= $sheet->row_count; $r++) {
        $trheight = $sheet->disp->get_row_size($r);
        print "  <tr height=\"" . $trheight . "\">" . "\n";
        for ($i = 0; $i <= $sheet->col_count; $i++) {
            $tdwidth = $sheet->disp->get_col_size($i);
            $dispval = $xls->dispcell($sn, $r, $i);
            $dispval = strconv($dispval);
            if (isset($xls->hlink[$sn][$r][$i])) {
                $dispval = "<a href=\"" . $xls->hlink[$sn][$r][$i] . "\">" . $dispval . "</a>";
            }
            $xf = $xls->getAttribute($sn, $r, $i);
            if (isset($xf["wrap"]) && $xf["wrap"]) {
                $dispval = preg_replace('/\\n/', '<br />', $dispval);
            }
            $xfno = $xf["xf"] > 0 ? $xf["xf"] : 0;
            $align = "x";
            if (isset($xf["halign"]) && $xf["halign"] != 0) {
                $align = "";
            }
            if ($align == "x") {
                if ($xf["type"] == Type_RK) {
                    $align = " align=\"right\"";
                } else {
                    if ($xf["type"] == Type_RK2) {
                        $align = " align=\"right\"";
                    } else {
                        if ($xf["type"] == Type_NUMBER) {
                            $align = " align=\"right\"";
                        } else {
                            if ($xf["type"] == Type_FORMULA && is_numeric($dispval)) {
                                $align = " align=\"right\"";
                            } else {
                                if ($xf["type"] == Type_FORMULA2 && is_numeric($dispval)) {
                                    $align = " align=\"right\"";
                                } else {
                                    if ($xf["type"] == Type_FORMULA && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                        $align = " align=\"center\"";
                                    } else {
                                        if ($xf["type"] == Type_FORMULA2 && ($dispval == "TRUE" || $dispval == "FALSE")) {
                                            $align = " align=\"center\"";
                                        } else {
                                            if ($xf["type"] == Type_BOOLERR) {
                                                $align = " align=\"center\"";
                                            } else {
                                                $align = '';
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if ($xf["format"] == "@") {
                    $align = "";
                }
            } else {
                $align = "";
            }
            if (substr($dispval, 0, 1) == "'") {
                $dispval = substr($dispval, 1);
            }
            if (substr($dispval, 0, 6) == "&#039;") {
                $dispval = substr($dispval, 6);
            }
            // セル表示
            if (isset($xf["fillpattern"]) && $xf["fillpattern"] == 1) {
                if ($xf["PtnFRcolor"] == COLOR_FILL) {
                    $bgcolor = 2;
                } else {
                    $bgcolor = 1;
                }
                // other
            } else {
                $bgcolor = 0;
            }
            $celattr = $xls->getAttribute($sn, $r, $i);
            $fontsize = $celattr["font"]["height"] * $sheet->scale / 16;
            if (isset($xls->celmergeinfo[$sn][$r][$i]["cond"])) {
                if ($xls->celmergeinfo[$sn][$r][$i]["cond"] == 1) {
                    $colspan = $xls->celmergeinfo[$sn][$r][$i]["cspan"];
                    $rowspan = $xls->celmergeinfo[$sn][$r][$i]["rspan"];
                    if ($colspan > 1) {
                        $rcspan = " colspan=\"" . $colspan . "\"";
                    } else {
                        $rcspan = " width=\"" . $tdwidth . "\"";
                    }
                    if ($rowspan > 1) {
                        $rcspan .= " rowspan=\"" . $rowspan . "\"";
                    }
                    if ($bgcolor == 1 && !is_null($dispval)) {
                        $id = $sn . "-" . $r . "-" . $i;
                        if (trim($dispval)) {
                            $field_list[$id] = $dispval;
                        } else {
                            $field_list[$id] = $dispval = $id;
                        }
                        $dispval = "<b>" . $dispval . "</b>";
                        $field_width[$id] = $tdwidth;
                    }
                    $class = " class=\"XFs" . $sn . "r" . $r . "c" . $i . "\"";
                    $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                    print " <td {$class} {$id} {$name} {$rcspan} {$align} style=\"font-size: " . $fontsize . "px;\">" . $dispval . "</td>\n";
                }
            } else {
                if ($bgcolor == 1 && !is_null($dispval)) {
                    $id = $sn . "-" . $r . "-" . $i;
                    if (trim($dispval)) {
                        $field_list[$id] = $dispval;
                    } else {
                        $field_list[$id] = $dispval = $id;
                    }
                    $dispval = "<b>" . $dispval . "</b>";
                    $field_width[$id] = $tdwidth;
                }
                $class = " class=\"XF" . $xfno . "\" ";
                $id = " id=\"" . $sn . "-" . $r . "-" . $i . "\"";
                print " <td nowrap=\"nowrap\" {$class} {$id} {$align} style=\"font-size: " . $fontsize . "px;\">" . $dispval . "</td>\n";
            }
        }
        print "</tr>\n";
    }
    print "</table>\n";
    // シートテーブル終了
    // print "</div>\n"; // シート終了 (simpleTabsContent)
    // print "</div>\n"; // タブ全体終了 (simpleTabs)
    print "</center><br />\n";
}
예제 #6
0
파일: sht_verify.php 프로젝트: sohgo/faxocr
if (isset($file_id) && $file_id) {
    $tgt_file = DST_DIR . $file_id . ".xls";
} else {
    // XXX: $errmsg = "ファイルが読み込めません";
    put_err_page("不正なアクセスです");
    die;
}
//
// ヘッダ処理
//
$header_opt .= "<script type=\"text/javascript\" src=\"/external/js/jquery-1.4.1.min.js\"></script>\n";
include TMP_HTML_DIR . "tpl.header.html";
if ($errmsg) {
    // エラーメッセージ処理
    print "<blockquote><font color=\"red\"><strong>";
    print strconv($errmsg);
    print "</strong></font></blockquote>";
}
// ステータス表示
put_status($file_id, $group_id, $sheet_id);
print "<div align=\"center\" style=\"background-color: lightgray;\">\n";
print "<BR>\n";
//	if (file_exists(DST_DIR . $file_id . ".png")) {
if (file_exists(DST_DIR . $group_id . "-" . $sheet_id . ".png")) {
    print "<img src=\"/external/getimg/" . $group_id . "/" . $sheet_id . "\" width=\"500px\"><br>\n";
    print "<a href=\"/external/download/" . $group_id . "/" . $sheet_id . "\">[PDFプレビュー]</a>\n";
} else {
    print "画像ファイルがありません {$file_id}<br><br>\n";
}
print "</div>\n";
print "<div align=\"right\">\n";