当前位置: 首页>>代码示例>>PHP>>正文


PHP Excel::home方法代码示例

本文整理汇总了PHP中Excel::home方法的典型用法代码示例。如果您正苦于以下问题:PHP Excel::home方法的具体用法?PHP Excel::home怎么用?PHP Excel::home使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Excel的用法示例。


在下文中一共展示了Excel::home方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 public function prepare($title, $tableData)
 {
     $this->writer = new Excel($title);
     foreach ($tableData as $row) {
         $this->writer->home();
         foreach ($row as $cell) {
             $this->writer->label($cell);
             $this->writer->right();
         }
         $this->writer->down();
     }
 }
开发者ID:nabble,项目名称:ajde,代码行数:12,代码来源:Excel.php

示例2: exportIt

 public function exportIt($return)
 {
     return parent::exportIt($return);
     $filename = $return['classname'] . "_" . date('Ymd');
     $xls = new Excel($filename);
     //$filename = $return['classname'] . "_" . date('Ymd') . ".xls";
     //header("Content-Disposition: attachment; filename=\"$filename\"");
     //header("Content-Type: application/vnd.ms-excel");
     //$flag = false;
     $xls->home();
     foreach ($return['objs'] as $key => $obj) {
         foreach ($obj as $name => $value) {
             $xls->label(Lang::t($name));
             $xls->right();
         }
         break;
     }
     $xls->down();
     //print("\n");
     foreach ($return['objs'] as $key => $obj) {
         $xls->home();
         foreach ($obj as $name => $value) {
             $xls->label($value);
             $xls->right();
         }
         $xls->down();
     }
     $xls->send();
     exit;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:30,代码来源:Model.php

示例3: excel_encode

function excel_encode($response)
{
    $xls = new Excel('verifier-search');
    $xls->home();
    $xls->label('state fips');
    $xls->right();
    $xls->label('state');
    $xls->right();
    $xls->label('precincts');
    $xls->down();
    foreach ($response['codes'] as $row) {
        $xls->home();
        $xls->label($row['state_fips']);
        $xls->right();
        $xls->label($row['name']);
        $xls->right();
        $xls->label($row['precincts']);
        $xls->down();
    }
    $xls->send();
}
开发者ID:radicaldesigns,项目名称:verified_voting_wp,代码行数:21,代码来源:api_functions.php

示例4: exportIt

 public function exportIt()
 {
     $data = isset($_SESSION["data"]) ? addslashes($_SESSION['data']) : "";
     //        $dec = json_decode($data);
     $arrData = $_SESSION['data'];
     unset($_SESSION['data']);
     $filename = date('Ymd') . ".xls";
     header("Content-Disposition: attachment; filename=\"{$filename}\"");
     header("Content-Type: application/vnd.ms-excel");
     $xls = new Excel($filename);
     $xls->home();
     //        pr($arrData);
     foreach ($arrData as $key => $obj) {
         foreach ($obj as $name => $value) {
             $xls->label(Lang::t($name));
             $xls->right();
         }
         break;
     }
     $xls->down();
     foreach ($arrData as $key => $obj) {
         $xls->home();
         foreach ($obj as $name => $value) {
             if ($name == "dateOrder") {
                 $date = new DateTime($value);
                 $xls->label($date->format('d.m.Y'));
             } elseif ($name == "timeOrder") {
                 $date = new DateTime($value);
                 $xls->label($date->format('H:i:s'));
             } else {
                 $xls->label($value);
             }
             $xls->right();
         }
         $xls->down();
     }
     $xls->send();
     exit;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:martabak_revolution,代码行数:39,代码来源:Report.php

示例5: write_excel1

function write_excel1($quarter, $dept)
{
    $xls = new Excel('TAData');
    $xls->home();
    $xls->top();
    $xls->label("Name");
    $xls->right();
    $xls->label("Likes");
    $xls->right();
    $xls->label("Hates");
    $xls->right();
    $xls->label("Conflicts");
    $xls->right();
    $xls->label("# Classes Taught");
    $xls->right();
    $xls->label("Ranking");
    $xls->right();
    $xls->label("Units");
    $xls->right();
    $xls->label("%");
    $xls->home();
    $xls->down();
    $db = new PDO(DB_PATH, DB_LOGIN, DB_PW);
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    try {
        //for each TA we need to gather the prefs and blacklist not given in the input file.
        $sql = "SELECT * from ta WHERE department = \"{$dept}\";";
        $results = $db->query($sql);
        foreach ($results as $re) {
            //The headers are as seen above. We tackle each in turn.
            $xls->label($re['name_full']);
            $xls->right();
            $prefs = get_prefs($re['sid'], $quarter);
            $likes = array();
            $dislikes = array();
            for ($i = 0; $i < count($prefs); $i++) {
                if ($prefs[$i]->value > 50) {
                    array_push($likes, $prefs[$i]);
                } else {
                    if ($prefs[$i]->value < 50) {
                        array_push($dislikes, $prefs[$i]);
                    }
                }
                usort($likes, prefcmp);
                usort($dislikes, prefcmpr);
            }
            $likes_full = "";
            for ($i = 0; $i < count($likes) - 1; $i++) {
                $likes_full .= $likes[$i]->section;
                $likes_full .= ", ";
            }
            $likes_full .= $likes[count($likes) - 1]->section;
            //   if($re['sid'] == 6260) puts($likes_full);
            $dislikes_full = "";
            for ($i = 0; $i < count($dislikes) - 1; $i++) {
                $dislikes_full .= $dislikes[$i]->section;
                $dislikes_full .= ", ";
            }
            $dislikes_full .= $dislikes[count($dislikes) - 1]->section;
            //   if($re['sid'] == 6260) puts($dislikes_full);
            $xls->label($likes_full);
            $xls->right();
            $xls->label($dislikes_full);
            $xls->right();
            //Now conflicts. This should be as simple as adding together all the events of TA.
            $sql2 = 'SELECT e.start, e.end, e.day FROM event e, calendar c WHERE c.id_event=e.id
               AND c.id_ta = ' . $re['sid'] . ' AND e.id_quarter = ' . $quarter . ';';
            $result2 = $db->query($sql2);
            $conflict_full = "";
            foreach ($result2 as $r2) {
                $conflict_full .= $r2['day'] . ' ' . round($r2['start'] / 100) . '-' . round($r2['end'] / 100) . ', ';
            }
            $conflict_full = substr($conflict_full, 0, -2);
            //   if($re['sid'] == 6260) puts($conflict_full);
            $xls->label($conflict_full);
            $xls->right();
            $u = $re['units'];
            $xls->label((int) ($u / 2));
            $xls->right();
            $xls->label($re['rank']);
            $xls->right();
            $xls->label((int) $u);
            $xls->right();
            $xls->label((int) ($u * 12.5));
            $xls->down();
            $xls->home();
            //  puts($re['name_full']."|".$likes_full);
            //  print_r($likes);
            //  print_r($dislikes);
        }
        $xls->send();
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
开发者ID:Quiksilver626,项目名称:tamatch,代码行数:95,代码来源:functions.php


注:本文中的Excel::home方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。