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


PHP PHPExcel_Style::applyFromArray方法代码示例

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


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

示例1: index

 public function index()
 {
     $this->load->model('Juego_model');
     $rs = $this->Juego_model->get_entries();
     foreach ($rs as $key => $value) {
         $rs[$key]['total_incorrectas'] = (int) $value['puntos_total'] - (int) $value['puntos'];
         $rs[$key]['more'] = $this->Juego_model->get_entries_detalle($value['id_juego']);
     }
     $this->load->library('Excel');
     //$this->excel->setActiveSheetIndex(0);
     $objPHPExcel = $this->excel;
     // set hoja 2
     $objPHPExcel = $this->_reportDetalle($objPHPExcel, $rs);
     $sheet = $objPHPExcel->getSheet(1);
     // Sheet 1
     $objPHPExcel->getProperties()->setCreator("PLATICOM")->setLastModifiedBy("PLATICOM")->setTitle("REGISTROS PLATICOM-RESPONDE")->setSubject("REGISTROS PLATICOM-RESPONDE")->setDescription("REGISTROS PLATICOM-RESPONDE")->setKeywords("REGISTROS PLATICOM-RESPONDE")->setCategory("plataticom-records");
     $tituloReporte = "REGISTROS PLATICOM-PLAY";
     $titulosColumnas = array('INDICE', 'CODIGO USUARIO', 'RPTA CORRECTAS', 'RPTA INCORRECTAS', 'TOTAL PREGUNTAS', 'FECHA', '.', '.');
     // set headers *excel*
     $sheet->mergeCells('A1:E2');
     $sheet->setCellValue('A1', $tituloReporte)->setCellValue('A4', $titulosColumnas[0])->setCellValue('B4', $titulosColumnas[1])->setCellValue('C4', $titulosColumnas[2])->setCellValue('D4', $titulosColumnas[3])->setCellValue('E4', $titulosColumnas[4])->setCellValue('F4', $titulosColumnas[5])->setCellValue('G4', $titulosColumnas[6])->setCellValue('H4', $titulosColumnas[7]);
     // print data
     $i = 5;
     $contador = 1;
     foreach ($rs as $item) {
         $sheet->setCellValue('A' . $i, $contador)->setCellValue('B' . $i, $item['codigo_usuario'])->setCellValue('C' . $i, $item['puntos'])->setCellValue('D' . $i, $item['total_incorrectas'])->setCellValue('E' . $i, $item['puntos_total'])->setCellValue('F' . $i, $item['fecha_fin']);
         $i++;
         $contador++;
     }
     // STYLE EXCEL
     $estiloTituloReporte = array('font' => array('name' => 'Verdana', 'bold' => true, 'italic' => false, 'strike' => false, 'size' => 16, 'color' => array('rgb' => 'FFFFFF')), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FF244062')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_NONE)), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, 'rotation' => 0, 'wrap' => TRUE));
     $estiloTituloColumnas = array('font' => array('name' => 'Arial', 'bold' => true, 'size' => '11', 'color' => array('rgb' => 'FFFFFF')), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFA5A5A5')), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '143860')), 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '143860')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '143860'))), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, 'wrap' => TRUE));
     $estiloInformacion = new PHPExcel_Style();
     $estiloInformacion->applyFromArray(array('font' => array('name' => 'Arial', 'color' => array('rgb' => '000000')), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFDCE6F1')), 'borders' => array('right' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '3a2a47')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('rgb' => '3a2a47')))));
     $sheet->getStyle('A1:E2')->applyFromArray($estiloTituloReporte);
     $sheet->getStyle('A4:H4')->applyFromArray($estiloTituloColumnas);
     $sheet->setSharedStyle($estiloInformacion, "A5:H" . ($i - 1));
     $sheet->getColumnDimension('A')->setWidth(5);
     $sheet->getColumnDimension('B')->setWidth(15);
     $sheet->getColumnDimension('C')->setWidth(20);
     $sheet->getColumnDimension('D')->setWidth(20);
     $sheet->getColumnDimension('E')->setWidth(20);
     $sheet->getColumnDimension('F')->setWidth(20);
     $sheet->getColumnDimension('G')->setWidth(20);
     $sheet->getColumnDimension('H')->setWidth(20);
     // PRINT EXCEL
     $fecha = date('d-m-Y');
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;filename="' . __FUNCTION__ . '-' . $fecha . '.xls"');
     // 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('Content-Type: text/html; charset=UTF-8');
     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');
     exit;
 }
开发者ID:enlacee,项目名称:app-test-api,代码行数:65,代码来源:ReportPlay.php

示例2: export_xls

 public function export_xls(string $fileName, array $head, array $data, $row1 = 'B')
 {
     import("Common.Org.PHPExcel");
     import("Common.Org.PHPExcel.Writer.Excel5");
     import("Common.Org.PHPExcel.IOFactory.php");
     $objPHPExcel = new \PHPExcel();
     $objProps = $objPHPExcel->getProperties();
     $objActSheet = $objPHPExcel->getActiveSheet();
     $objActSheet->getStyle()->getFont()->setName('微软雅黑');
     //设置字体
     $objActSheet->getDefaultRowDimension()->setRowHeight(25);
     //设置默认高度
     $row = ord($row1);
     $row2 = chr($row + count($head) - 1);
     foreach ($head as $v) {
         if ($v['width'] > 0) {
             $objActSheet->getColumnDimension(chr($row))->setWidth($v['width']);
         }
         //设置列宽
         $row++;
     }
     //设置边框
     $sharedStyle1 = new \PHPExcel_Style();
     $sharedStyle1->applyFromArray(array('borders' => array('allborders' => array('style' => \PHPExcel_Style_Border::BORDER_THIN))));
     $column = 2;
     foreach ($data as $idx => $value) {
         $objActSheet->setSharedStyle($sharedStyle1, "{$row1}{$column}:{$row2}{$column}");
         //设置边框
         $objActSheet->mergeCells("{$row1}{$column}:{$row2}{$column}");
         //合并单元格
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFont()->setSize(12);
         //字体
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFont()->setBold(true);
         //粗体
         //背景色填充
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFill()->getStartColor()->setARGB('FFB8CCE4');
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
         //垂直居中
         $objActSheet->setCellValue($row1 . $column, $idx + 1 . ". " . $value['name']);
         $column++;
         $objActSheet->setSharedStyle($sharedStyle1, "{$row1}{$column}:{$row2}{$column}");
         //设置边框
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getFill()->getStartColor()->setARGB('FF4F81BD');
         $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
         //垂直居中
         $row = ord($row1);
         foreach ($head as $k => $v) {
             $row_temp = chr($row++);
             $objActSheet->setCellValue($row_temp . $column, $v['label']);
             if ($v['align'] == 'center') {
                 $objActSheet->getStyle("{$row_temp}{$column}")->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             }
             //水平居中
         }
         foreach ($value['items'] as $index => $val) {
             $column++;
             $objActSheet->setSharedStyle($sharedStyle1, "{$row1}{$column}:{$row2}{$column}");
             //设置边框
             $objActSheet->getStyle("{$row1}{$column}:{$row2}{$column}")->getAlignment()->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
             //垂直居中
             $objPHPExcel->getActiveSheet()->getStyle("B{$column}:I{$column}")->getAlignment()->setWrapText(true);
             //换行
             //行写入
             $row = ord($row1);
             foreach ($head as $k => $v) {
                 $row_temp = chr($row++);
                 $_value = $v['name'] == '$index' ? $index + 1 : $val[$v['name']];
                 if ($v['filter']) {
                     $_value = $v['filter']($_value);
                 }
                 $objActSheet->setCellValue($row_temp . $column, $_value);
                 if ($v['align'] == 'center') {
                     $objActSheet->getStyle("{$row_temp}{$column}")->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
                 }
                 //水平居中
             }
         }
         $column++;
         $column++;
     }
     $date = date("Y_m_d", time());
     $fileName .= "_{$date}.xls";
     $fileName = iconv("utf-8", "gb2312", $fileName);
     //设置活动单指数到第一个表,所以Excel打开这是第一个表
     $objPHPExcel->setActiveSheetIndex(0);
     header('Content-Type: application/vnd.ms-excel');
     header("Content-Disposition: attachment;filename=\"{$fileName}\"");
     header('Cache-Control: max-age=0');
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     //文件通过浏览器下载
 }
开发者ID:Orchild,项目名称:mt,代码行数:94,代码来源:DbLogic.class.php

示例3: getTabMember

require_once "../include/lib/phpexcel/PHPExcel.php";
require_once "../include/lib/phpexcel/PHPExcel/Writer/Excel2007.php";
////////////////////////////////////////////////////////////////////
$tabMember = getTabMember("", $_SESSION['sqlQuery'], -1, $_REQUEST['sort']);
$rand = rand(0, 10000);
$filename = "list-members-" . $login . "-" . $rand . ".xls";
$filepath = "../xls/" . $filename;
$objPHPExcel = new PHPExcel();
$objPHPExcel->getActiveSheet()->setTitle('QCS');
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getDefaultStyle()->getFont()->setName('Arial');
$objPHPExcel->getDefaultStyle()->getFont()->setSize(10);
// STYLE TITRE
////////////////////////////////////////////////////////////
$styleTitre = new PHPExcel_Style();
$styleTitre->applyFromArray(array('font' => array('name' => 'Arial', 'bold' => true, 'size' => '12', 'color' => array('rgb' => 'FFFFFF')), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'DF0101')), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER)));
$objPHPExcel->getActiveSheet()->setSharedStyle($styleTitre, "A1:U1");
// TAILE DES COLONNES ///////////////////////////////////////////////
$objPHPExcel->getActiveSheet()->getColumnDimension("A")->setWidth(10);
$objPHPExcel->getActiveSheet()->getColumnDimension("B")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("C")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("D")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("E")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("F")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("G")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("H")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("I")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("J")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("K")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("L")->setWidth(30);
$objPHPExcel->getActiveSheet()->getColumnDimension("M")->setWidth(30);
开发者ID:qcstw-dev,项目名称:qcsasia,代码行数:31,代码来源:exportXLS.php

示例4: generar_xls_operadores

/**
 * 
 * @todo Funcion que genera el xls de operadores para enviarlo por mail
 * @author Jean Carlos Nuñez
 * @param  int $var_cod_salida
 * @param  int $var_tipo
 * @param  string $var_num_und
 * @param  int $var_odt
 * @return json
 *  
 */
function generar_xls_operadores($var_montado = 1)
{
    global $conn;
    if ($var_montado == 1) {
        $sSql = "select concat(o.nombre,' ',o.apellido) as nombre,o.cedula from operadores o where o.nombre <> '0'";
    }
    if ($var_montado == 2) {
        $sSql = "select concat(o.nombre,' ',o.apellido) as nombre,o.cedula from operadores o where o.num_und_asig = '0'  ";
    }
    $sSql .= " order by o.nombre ";
    error_reporting(E_ALL);
    ini_set('display_errors', TRUE);
    ini_set('display_startup_errors', TRUE);
    date_default_timezone_set('Europe/London');
    if (PHP_SAPI == 'cli') {
        die('This example should only be run from a Web Browser');
    }
    /** Include PHPExcel */
    require_once 'lib/PHPExcel/Classes/PHPExcel.php';
    // Create new PHPExcel object
    $objPHPExcel = new PHPExcel();
    $sharedStyle1 = new PHPExcel_Style();
    // Set document properties
    $objPHPExcel->getProperties()->setCreator("Jean Carlos Nuñez")->setLastModifiedBy("Jean Carlos Nuñez")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Archivo para Empresa de Seguro")->setKeywords("office 2007 openxml php")->setCategory("Archivo para Empresa de Seguro");
    $sharedStyle1->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFFFF')), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
    // Add some data
    $objDrawing = new PHPExcel_Worksheet_Drawing();
    //$objDrawing->setPath('yellow_excel.png');
    //$objDrawing->setHeight(70);
    //$objDrawing->setCoordinates('A1');
    //$objDrawing->setWorksheet($objPHPExcel->getActiveSheet(0));
    if ($var_montado == "1") {
        $var_montado_descripcion = "MONTADOS";
    } else {
        $var_montado_descripcion = "NO MONTADOS";
    }
    /*$objPHPExcel->setActiveSheetIndex(0)
    		->setCellValue('A5', 'Yellow Car, S.A')
               ->setCellValue('A6', 'Reporte Operadores')
               ->setCellValue('A7',$var_montado_descripcion);*/
    //$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A9:B9");
    // Miscellaneous glyphs, UTF-8
    /*$objPHPExcel->setActiveSheetIndex(0)
               ->setCellValue('A9', 'Nombre')
    		->setCellValue('B9', 'Cedula');*/
    $con = 1;
    $var_monto = 0;
    $rs_e = phpmkr_query($sSql, $conn) or die("Fallo al ejecutar la consulta en la linea" . __LINE__ . ": " . phpmkr_error($conn) . '<br>SQL: ' . $sSql);
    while ($row_rs_e = $rs_e->fetch_assoc()) {
        $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $con, $row_rs_e['nombre'])->setCellValue('B' . $con, trim($row_rs_e['cedula']));
        $con = $con + 1;
    }
    $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(40);
    $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(12);
    // Set active sheet index to the first sheet, so Excel opens this as the first sheet
    $objPHPExcel->setActiveSheetIndex(0);
    // Redirect output to a client’s web browser (Excel5)
    //header('Content-Type: application/vnd.ms-excel');
    //header('Content-Disposition: attachment;filename="operadores.xls"');
    //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("mail/operadores.xls");
    //exit;
}
开发者ID:jeann2013,项目名称:observatorio,代码行数:86,代码来源:db.php

示例5: _signupSheet

 protected function _signupSheet($event, $includeEndingTerms, $includeNotEndingTerms)
 {
     $sheet = new PHPExcel_Worksheet($this->_excelDoc, 'Signup Sheet for Workshop ' . $event['workshopTitle']);
     // Set up the margins so the header doesn't bleed into the page
     $sheet->getPageMargins()->setTop(1.5);
     // Make a three column page layout
     $sheet->getColumnDimension('A')->setWidth(16);
     $sheet->getColumnDimension('B')->setWidth(16);
     $sheet->getColumnDimension('C')->setWidth(45);
     $config = new Zend_Config_Xml(APPLICATION_PATH . '/configs/config.xml', 'production');
     $date = new DateTime($event['date']);
     $startTime = new DateTime($event['startTime']);
     $endTime = new DateTime($event['endTime']);
     // Set the header on odd pages.
     // The code formatting is off because the header doesn't ignore spaces.
     /*
      * Format:
      *        Title
      *        Room name
      *        date('D, M d, Y') (startTime('g:i A') - endTime('g:i A'))
      *        Instructors  
      * 
      */
     $sheet->getHeaderFooter()->setOddHeader('&C&B&14' . $event['workshopTitle'] . '&14&B&12 ' . chr(10) . $event['location'] . chr(10) . $date->format('l, M d, Y') . '(' . $startTime->format('g:i A') . ' - ' . $endTime->format('g:i A') . ')' . chr(10) . 'Instructor: ' . implode(',', $event['instructors']) . '&12&C');
     // Write Column Headers for the table
     $sheet->setCellValue('A1', 'First Name');
     $sheet->setCellValue('B1', 'Last Name');
     $sheet->setCellValue('C1', 'Signature');
     // reformat it a little bit in a simpler way for us to use it in our
     // spreadsheet printin' loop
     $rows = array();
     foreach ($event['attendeeList'] as $a) {
         $rows[] = array($a['firstName'], $a['lastName']);
     }
     $signin = new PHPExcel_Style();
     $signin->applyFromArray(array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
     $rowCounter = 3;
     foreach ($rows as $row) {
         $row = array_values($row);
         // put the totals in the row
         $char = self::A;
         foreach ($row as $cell) {
             $sheet->setCellValue(chr($char) . $rowCounter, $cell);
             $char++;
         }
         $rowCounter++;
     }
     $tableHeaderStyle = new PHPExcel_Style();
     $tableHeaderStyle->applyFromArray($this->_tableHeaderStyleArray);
     $tableBodyStyle = new PHPExcel_Style();
     $tableBodyStyle->applyFromArray($this->_contentStyleArray);
     $sheet->setSharedStyle($tableHeaderStyle, 'A1:C1');
     $sheet->setSharedStyle($tableBodyStyle, 'A3:B' . ($rowCounter - 1));
     $sheet->setSharedStyle($signin, 'C3:C' . ($rowCounter - 1));
     return $sheet;
 }
开发者ID:ncsuwebdev,项目名称:classmate,代码行数:56,代码来源:EventExcel.php

示例6: generateDocument

 /**
  * (non-PHPdoc)
  * @see \scipper\Datatransfer\TransferService::generateEmptyDocument()
  */
 public function generateDocument(Map $map)
 {
     if (!class_exists("PHPExcel")) {
         throw new GenerationException("dependency 'PHPExcel' not found");
     }
     $excel = new \PHPExcel();
     $excel->removeSheetByIndex(0);
     $excel->getProperties()->setCreator($map->getCreator());
     $excel->getProperties()->setTitle($map->getTitle());
     $protectedStyle = new \PHPExcel_Style();
     $protectedStyle->applyFromArray(array("fill" => array("type" => \PHPExcel_Style_Fill::FILL_SOLID, "color" => array("argb" => "55CCCCCC")), "borders" => array("bottom" => array("style" => \PHPExcel_Style_Border::BORDER_THIN), "right" => array("style" => \PHPExcel_Style_Border::BORDER_MEDIUM))));
     $i = 0;
     foreach ($map->getSheets() as $sheet) {
         $active = $excel->addSheet(new \PHPExcel_Worksheet(NULL, $sheet->getTitle()), $i);
         $active->getProtection()->setSheet(true);
         $active->getStyle("A1:Z30")->getProtection()->setLocked(\PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
         foreach ($sheet->getCells() as $cell) {
             //Convert content to list format ist necessary
             if ($cell->getType() == "select") {
                 $dataValidation = $active->getCell($cell->getCoord())->getDataValidation();
                 $dataValidation->setType(\PHPExcel_Cell_DataValidation::TYPE_LIST);
                 $dataValidation->setAllowBlank(false);
                 $dataValidation->setShowInputMessage(true);
                 $dataValidation->setShowDropDown(true);
                 $dataValidation->setFormula1($cell->getContent());
             } else {
                 $active->setCellValue($cell->getCoord(), $cell->getValue());
             }
             //Add protection is necessary
             if ($cell->isProtected()) {
                 $active->protectCells($cell->getCoord(), "123");
                 $active->setSharedStyle($protectedStyle, $cell->getCoord());
                 // 				} elseif(!$cell->isProtected() && $active->getProtection()->isProtectionEnabled()) {
                 // 					$active->unprotectCells($cell->getCoord());
             }
             $active->getColumnDimension($cell->getX())->setAutoSize(true);
             if (!$cell->isVisible()) {
                 $active->getColumnDimension($cell->getX())->setVisible(false);
             }
         }
         $i++;
     }
     $excel->setActiveSheetIndex(0);
     $writer = \PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
     $filename = $this->documentRoot . $excel->getProperties()->getTitle() . ".xlsx";
     $writer->save($filename);
     return $filename;
 }
开发者ID:scipper,项目名称:datatransfer,代码行数:52,代码来源:ExcelTransferService.php

示例7: array

<?php

$estiloTituloReporte = array('font' => array('name' => 'Arial', 'bold' => true, 'italic' => false, 'strike' => false, 'size' => 12, 'color' => array('rgb' => '000000')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_NONE)));
$estiloTituloColumnas = array('font' => array('name' => 'Arial', 'bold' => true, 'color' => array('rgb' => 'FFFFFF'), 'size' => 10), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('rgb' => '112CF2'), 'endcolor' => array('argb' => 'FF431a5d')), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '143860')), 'bottom' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '143860')), 'allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER, 'wrap' => TRUE));
$estiloInformacion = new PHPExcel_Style();
$estiloInformacion->applyFromArray(array('font' => array('name' => 'Arial', 'color' => array('rgb' => '000000')), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'E7EAFF')), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
开发者ID:paarma,项目名称:BibliotecaFupWeb,代码行数:6,代码来源:stylleCellExcel.php

示例8: date

date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../PHPExcel/PHPExcel.php';
// Create new PHPExcel object
echo date('H:i:s'), " Create new PHPExcel object", EOL;
$objPHPExcel = new PHPExcel();
// Set document properties
echo date('H:i:s'), " Set document properties", EOL;
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")->setLastModifiedBy("Maarten Balliauw")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
// Add some data
echo date('H:i:s'), " Add some data", EOL;
$objPHPExcel->setActiveSheetIndex(0);
$sharedStyle1 = new PHPExcel_Style();
$sharedStyle2 = new PHPExcel_Style();
$sharedStyle1->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFCCFFCC')), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM))));
$sharedStyle2->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFFFF00')), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM))));
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A1:T100");
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, "C5:R95");
// Save Excel 2007 file
echo date('H:i:s'), " Write to Excel2007 format", EOL;
$callStartTime = microtime(true);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
$callEndTime = microtime(true);
$callTime = $callEndTime - $callStartTime;
echo date('H:i:s'), " File written to ", str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)), EOL;
echo 'Call time to write Workbook was ', sprintf('%.4f', $callTime), " seconds", EOL;
// Echo memory usage
echo date('H:i:s'), ' Current memory usage: ', memory_get_usage(true) / 1024 / 1024, " MB", EOL;
// Save Excel 95 file
echo date('H:i:s'), " Write to Excel5 format", EOL;
开发者ID:panyijie,项目名称:wukongHRM,代码行数:31,代码来源:23sharedstyles.php

示例9: array

	)
);
$ssBG1 = new PHPExcel_Style();
$ssBG1->applyFromArray(
	array(
		'fill'	=> array(
			'type'		=> PHPExcel_Style_Fill::FILL_SOLID,
			'color'		=> array('rgb' => 'FFCC99')
		)
	)
);
$ssBG2 = new PHPExcel_Style();
$ssBG2->applyFromArray(
	array(
		'fill'	=> array(
			'type'		=> PHPExcel_Style_Fill::FILL_SOLID,
			'color'		=> array('rgb' => 'CCCCFF')
		)
	)
);
//-------- competitors ----------
createSheetComps($xlsx->getActiveSheet());
//----------- events ------------
$l = sql_num_rows($events);
for ($evt=0;$evt<$l;$evt++)
{
	$lrnd = 4;
	while($lrnd>1 && !cased_mysql_result($events,$evt,"r$lrnd")) $lrnd--;
	$rnd = 1;
	//while($rnd <= 4 && cased_mysql_result($events,$evt,"r".$rnd."_open"))
	while($rnd <= $lrnd)
	{
开发者ID:pedrosino,项目名称:cubecomps.com,代码行数:32,代码来源:xls.php

示例10: array

$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(11);
$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(6.86);
$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(7.43);
$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(6.29);
$objPHPExcel->getActiveSheet()->getColumnDimension('L')->setWidth(15.29);
$objPHPExcel->getActiveSheet()->getColumnDimension('M')->setWidth(11.1);
// Set autofilter
// Always include the complete filter range!
// Excel does support setting only the caption
// row, but that's not a best practise...
$objPHPExcel->getActiveSheet()->setAutoFilter($objPHPExcel->getActiveSheet()->calculateWorksheetDimension());
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
$sharedStyle1 = new PHPExcel_Style();
$sharedStyle2 = new PHPExcel_Style();
$sharedStyle1->applyFromArray(array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM), 'left' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM))));
$objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A7:M{$nox}");
// Set style for header row using alternative method
$objPHPExcel->getActiveSheet()->getStyle('A7:M7')->applyFromArray(array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => 'FFA0A0A0'), 'endcolor' => array('argb' => 'FFFFFFFF'))));
// Add a drawing to the worksheet
//$objDrawing = new PHPExcel_Worksheet_Drawing();
//$objDrawing->setName('Logo');
//$objDrawing->setDescription('Logo');
//$objDrawing->setPath('../images/logo2.png');
//$objDrawing->setCoordinates('B2');
//$objDrawing->setHeight(120);
//$objDrawing->setWidth(120);
//$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objPHPExcel->getActiveSheet()->getStyle('A7:M1000')->getFont()->setName('Arial');
$objPHPExcel->getActiveSheet()->getStyle('A7:M1000')->getFont()->setSize(7);
// Merge cells
开发者ID:songolikur,项目名称:bukutamu-bootstrap,代码行数:31,代码来源:exp.php

示例11: download_cardrecharge

 /**	$operationtype:固定卡/随机卡,$money:金额,$km:卡密类型,$isrepeat:是否一次性,$rechargetime:过期时间,
 	$codepwd:密码,$maxrepeatcount:(固定卡)最多可重复性次数,$zhang	:总张数,
 	**/
 public function download_cardrecharge($operationtype, $money, $km, $isrepeat, $rechargetime, $codepwd, $maxrepeatcount, $zhang)
 {
     //PHPExcel.php文件的物理路径
     $path = str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']) . 'system/modules/phpexcel/';
     $path = $path . "PHPExcel.php";
     require_once $path;
     //卡密充值导出Excel
     $objPHPExcel = new PHPExcel();
     $objPHPExcel->setActiveSheetIndex(0)->mergeCells('A1:G1')->setCellValue('A1', '此次生成卡信息')->setCellValue('A2', '序号')->setCellValue('B2', '卡号')->setCellValue('C2', '密码')->setCellValue('D2', '卡密类型')->setCellValue('E2', '金额')->setCellValue('F2', '过期时间')->setCellValue('G2', '最多可重复次数');
     //表头结束
     $i = 3;
     $k = 0;
     while ($k < $zhang) {
         $objPHPExcel->getActiveSheet()->setCellValue('A' . ($k + $i), $k + 1);
         $objPHPExcel->getActiveSheet()->setCellValue('B' . ($k + $i), $km[$k]);
         $objPHPExcel->getActiveSheet()->setCellValueExplicit('C' . ($k + $i), $codepwd[$k], PHPExcel_Cell_DataType::TYPE_STRING);
         if ($isrepeat == 'Y') {
             $isrepeat = "一次性充值卡";
         }
         if ($isrepeat == 'N') {
             $isrepeat = "可重复性性充值";
         }
         $objPHPExcel->getActiveSheet()->setCellValue('D' . ($k + $i), $isrepeat);
         if (is_array($money)) {
             #数组
             $objPHPExcel->getActiveSheet()->setCellValue('E' . ($k + $i), $money[$k]);
         } else {
             #字符串
             $objPHPExcel->getActiveSheet()->setCellValue('E' . ($k + $i), $money);
         }
         $objPHPExcel->getActiveSheet()->setCellValue('F' . ($k + $i), date("Y-m-d", $rechargetime));
         $objPHPExcel->getActiveSheet()->setCellValue('G' . ($k + $i), $maxrepeatcount);
         $k++;
     }
     $objPHPExcel->getActiveSheet()->freezePane('A4');
     // Rename sheet
     $objPHPExcel->getActiveSheet()->setTitle('123');
     //Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objPHPExcel->setActiveSheetIndex(0);
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
     $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
     $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(15);
     $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(25);
     $sharedStyle1 = new PHPExcel_Style();
     $sharedStyle2 = new PHPExcel_Style();
     $sharedStyle3 = new PHPExcel_Style();
     $sharedStyle1->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'C0C0C0')), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
     $sharedStyle2->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFF00')), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'font' => array('size' => 12)));
     $sharedStyle3->applyFromArray(array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER), 'font' => array('size' => 18, 'color' => array('argb' => '1E90FF'))));
     $objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle1, "A2:G" . ($k + 2));
     $objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle2, "A2:G2");
     $objPHPExcel->getActiveSheet()->setSharedStyle($sharedStyle3, "A1:G1");
     // Redirect output to a client's web browser (Excel2007)
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     header('Content-Disposition: attachment;filename="此次生成卡信息.xlsx"');
     //表格导出的文件名
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:ping199143,项目名称:1ydb,代码行数:67,代码来源:download.cardrecharge.tpl.php

示例12: array

 /*Orientacion del papel*/
 $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
 $objDrawing = new PHPExcel_Worksheet_Drawing();
 $objDrawing->setName('Logo');
 $objDrawing->setDescription('Logo');
 $objDrawing->setPath('SINCOTEL_SOLUTIONS.jpg');
 $objDrawing->setHeight(50);
 $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
 /* ESTILOS */
 ///////////////////////////////////////////////////////////////////////////////
 $tituloStyle = new PHPExcel_Style();
 $tituloStyle->applyFromArray(array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THICK)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FF969696'))));
 $areaStyle = new PHPExcel_Style();
 $areaStyle->applyFromArray(array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFC8C8C8'))));
 $areaStyle2 = new PHPExcel_Style();
 $areaStyle2->applyFromArray(array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFC0C0C0'))));
 $areaStyle3 = new PHPExcel_Style();
 $areaStyle3->applyFromArray(array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => '#FFCC00'))));
 $areaStyle4 = new PHPExcel_Style();
 $areaStyle4->applyFromArray(array('font' => array('bold' => true), 'borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FF1CBCD2'))));
 $normalStyle = new PHPExcel_Style();
 $normalStyle->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
 ////////////////////////////////////////////////////////////////////////////////////////
 /*Escritura de celdas*/
 $objPHPExcel->setActiveSheetIndex(0);
 $objPHPExcel->getActiveSheet()->setCellValue('C1', "INFORME GENERADO POR MULTICONSULTA");
 $objPHPExcel->getActiveSheet()->setCellValue('C2', 'Proyecto: ' . sacar_nom_subproyecto($id_subproyecto, $link));
 // ENCABEZADO TABLA "TIEMPOS RESTANTES"
 $objPHPExcel->getActiveSheet()->setCellValue('A4', 'TIEMPOS (H) RESTANTES');
 $objPHPExcel->getActiveSheet()->setSharedStyle($tituloStyle, 'A4');
 $objPHPExcel->getActiveSheet()->setSharedStyle($tituloStyle, 'B4');
开发者ID:nsxa,项目名称:controlactividades,代码行数:31,代码来源:generar_Excel_dft.php

示例13: unduhexcel

 public function unduhexcel()
 {
     $objPHPExcel = new PHPExcel();
     //array style
     $style_header = array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT), 'borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'top' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'right' => array('style' => PHPExcel_Style_Border::BORDER_THIN), 'left' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => 'FFA0A0A0'), 'endcolor' => array('argb' => 'FFFFFFFF')));
     // Add some data
     $objset = $objPHPExcel->setActiveSheetIndex(0);
     //inisiasi set object
     $objget = $objPHPExcel->getActiveSheet();
     //inisiasi get object
     // Merge cells
     $objPHPExcel->getActiveSheet()->mergeCells('A9:K9');
     $objPHPExcel->getActiveSheet()->setCellValue('A9', "PENILAIAN PRESTASI KERJA");
     $objPHPExcel->getActiveSheet()->getStyle('A9:K9')->getFont()->setName('Times New Roman');
     $objPHPExcel->getActiveSheet()->getStyle('A9')->getFont()->setSize(14);
     $objPHPExcel->getActiveSheet()->getStyle('A9:K9')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('A9:K9')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->mergeCells('A10:K10');
     $objPHPExcel->getActiveSheet()->setCellValue('A10', "PEGAWAI NEGERI SIPIL");
     $objPHPExcel->getActiveSheet()->getStyle('A10:K10')->getFont()->setName('Times New Roman');
     $objPHPExcel->getActiveSheet()->getStyle('A10')->getFont()->setSize(14);
     $objPHPExcel->getActiveSheet()->getStyle('A10:K10')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('A10:K10')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     // Nomor
     $objget->setCellValue('B16', '1.');
     $objget->getStyle('B16')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('B16:B21')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('B')->setWidth(10);
     // set witdh colom
     $objget->getStyle('B16')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objget->setCellValue('B22', '2.');
     $objget->getStyle('B22')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('B22:B27')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('B')->setWidth(10);
     // set witdh colom
     $objget->getStyle('B22')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objget->setCellValue('B28', '3.');
     $objget->getStyle('B28')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('B28:B33')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('B')->setWidth(10);
     // set witdh colom
     $objget->getStyle('B28')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objget->setCellValue('B38', '4.');
     $objget->getStyle('B38')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('B38:B49')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('B')->setWidth(10);
     // set witdh colom
     $objget->getStyle('B38')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objget->setCellValue('C16', 'YANG DINILAI');
     $objget->getStyle('C16')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('C16')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(15);
     // set witdh colom
     $objget->getStyle('C16')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objPHPExcel->getActiveSheet()->mergeCells('C16:J16');
     $objget->setCellValue('C22', 'PEJABAT PENILAI');
     $objget->getStyle('C22')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('C22')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(15);
     // set witdh colom
     $objget->getStyle('C22')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objPHPExcel->getActiveSheet()->mergeCells('C22:J22');
     $objget->setCellValue('C28', 'ATASAN PEJABAT PENILAI');
     $objget->getStyle('C28')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('C28')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(15);
     // set witdh colom
     $objget->getStyle('C28')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objPHPExcel->getActiveSheet()->mergeCells('C28:J28');
     $objget->setCellValue('C38', 'UNSUR YANG DINILAI');
     $objget->getStyle('C38')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('C38')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(15);
     // set witdh colom
     $objget->getStyle('C38')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objPHPExcel->getActiveSheet()->mergeCells('C38:I38');
     $objget->setCellValue('J38', 'JUMLAH');
     $objget->getStyle('J38')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('J38')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(15);
     // set witdh colom
     $objget->getStyle('J38')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objget->setCellValue('J39', '53');
     $objget->getStyle('J39')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objget->getStyle('J39')->applyFromArray($style_header);
     // set font weight
     $objget->getColumnDimension('C')->setWidth(10);
     // set witdh colom
     $objget->getStyle('J39')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_TEXT);
     $objPHPExcel->getActiveSheet()->mergeCells('J39:J40');
     $objget->setCellValue('C17', 'a.');
//.........这里部分代码省略.........
开发者ID:biner-teknologi-indonesia,项目名称:dbaparatur,代码行数:101,代码来源:hasilpenilaian.php

示例14: render

 /**
  * Inserts data into worksheet and returns it
  * 
  * @return PHPExcel_Worksheet
  */
 public function render()
 {
     // Set worksheet header
     $this->_set_row(1, $this->columns, TRUE);
     //set header style
     $obj_style = new PHPExcel_Style();
     $style = Kohana::$config->load('phpexcel.header');
     $obj_style->applyFromArray($style);
     $column_dim = PHPExcel_Cell::stringFromColumnIndex(count($this->columns) - 1);
     $this->_worksheet->setSharedStyle($obj_style, 'A1:' . $column_dim . '1');
     // Set data
     $rows = 0;
     foreach ($this->data as $row => $data) {
         $this->_set_row($row + 2, $data);
         $rows++;
     }
     // Set column styles and width
     $column = 0;
     foreach (array_keys($this->columns) as $key) {
         $column_dim = PHPExcel_Cell::stringFromColumnIndex($column);
         $format = Arr::get($this->formats, $key);
         if ($format !== NULL) {
             $this->_worksheet->getStyle($column_dim . 2 . ':' . $column_dim . (2 + $rows))->getNumberFormat()->setFormatCode($format);
         }
         if ($this->auto_size === TRUE) {
             $this->_worksheet->getColumnDimension($column_dim)->setAutoSize(TRUE);
         }
         $column++;
     }
     return $this->_worksheet;
 }
开发者ID:efremovich,项目名称:kohana-phpexcel,代码行数:36,代码来源:Worksheet.php

示例15: _initSharedStyles

 /**
  * 
  */
 protected function _initSharedStyles()
 {
     $headerTable = new PHPExcel_Style();
     $rowEven = new PHPExcel_Style();
     $rowOdd = new PHPExcel_Style();
     $footerTable = new PHPExcel_Style();
     $borders = array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => 'FFDDDDDD')));
     $alignment = array('wrap' => true, 'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $headerTable->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFCFCFC')), 'borders' => $borders, 'font' => array('bold' => true), 'alignment' => $alignment));
     $footerTable->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFCFCFC')), 'borders' => $borders, 'font' => array('bold' => true), 'alignment' => $alignment, 'numberformat' => array('code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)));
     $rowEven->applyFromArray(array('borders' => $borders, 'alignment' => $alignment, 'numberformat' => array('code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)));
     $rowOdd->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('argb' => 'FFFCF9F9')), 'borders' => $borders, 'alignment' => $alignment, 'numberformat' => array('code' => PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)));
     $this->_styles['table_header'] = $headerTable;
     $this->_styles['table_footer'] = $footerTable;
     $this->_styles['row_even'] = $rowEven;
     $this->_styles['row_odd'] = $rowOdd;
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:20,代码来源:Excel.php


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