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


PHP PHPExcel_Worksheet::setTitle方法代码示例

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


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

示例1: mockSheet

 /**
  * @return \PHPExcel_Worksheet
  */
 protected function mockSheet()
 {
     $workbook = new \PHPExcel();
     $workbook->disconnectWorksheets();
     $sheet = new \PHPExcel_Worksheet($workbook);
     $sheet->setTitle('mocked');
     $sheet->fromArray([['a1', 'b1'], ['a2', 'b2']]);
     return $sheet;
 }
开发者ID:ymnl007,项目名称:Clerk,代码行数:12,代码来源:SheetParserTest.php

示例2: createTrueFalseArrayAndProductArray

 public function createTrueFalseArrayAndProductArray($objPHPExcel)
 {
     $firstSheet = $objPHPExcel->getSheet(0);
     $richtigFalschWerte = new PHPExcel_Worksheet($objPHPExcel);
     $richtigFalschWerte->setTitle('RichtigFalschWerte');
     $objPHPExcel->addSheet($richtigFalschWerte);
     $lastColumnRawData = $firstSheet->getHighestColumn();
     $maxColumn = $lastColumnRawData;
     $maxColumn++;
     $anzahlTeilnehmer = $firstSheet->getCell('C4')->getValue();
     //Erreichbare Punktzahl = $anzahlTeilnehmer + 12
     $endrow = $anzahlTeilnehmer + 6;
     $richtigFalschColumn = 'A';
     for ($column = 'G'; $column != $maxColumn; $column++) {
         $erreichbarePunkte = $firstSheet->getCell($column . ($anzahlTeilnehmer + 12))->getValue();
         for ($row = 7; $row <= $endrow; $row++) {
             if ($firstSheet->getCell($column . $row)->getCalculatedValue() >= 0.5 * (double) $erreichbarePunkte) {
                 $richtigFalschWerte->setCellValue($richtigFalschColumn . ($row - 6), 1);
             } else {
                 $richtigFalschWerte->setCellValue($richtigFalschColumn . ($row - 6), 0);
             }
         }
         $richtigFalschColumn++;
     }
     $lastColumnTrueFalseData = $richtigFalschWerte->getHighestColumn();
     $lastRowTrueFalseData = $richtigFalschWerte->getHighestRow();
     $summaryColumn = $lastColumnTrueFalseData;
     $summaryColumn++;
     for ($row = 1; $row <= $lastRowTrueFalseData; $row++) {
         $richtigFalschWerte->setCellValue($summaryColumn . $row, '=SUM( A' . $row . ':' . $lastColumnTrueFalseData . $row . ')');
     }
     $richtigFalschWerte->setCellValue($summaryColumn . ($lastRowTrueFalseData + 1), '=AVERAGE(' . $summaryColumn . '1:' . $summaryColumn . $lastRowTrueFalseData . ')');
     $richtigFalschWerte->setCellValue($summaryColumn . ($lastRowTrueFalseData + 2), '=VARP(' . $summaryColumn . '1:' . $summaryColumn . $lastRowTrueFalseData . ')');
     $richtigFalschWerte->setCellValue($summaryColumn . ($lastRowTrueFalseData + 3), '=SQRT(' . $summaryColumn . ($lastRowTrueFalseData + 2) . ')');
     $richtigFalschProdukte = new PHPExcel_Worksheet($objPHPExcel);
     $richtigFalschProdukte->setTitle('RichtigFalsch Produkte');
     $objPHPExcel->addSheet($richtigFalschProdukte);
     $aufgabenwerte = $richtigFalschWerte->rangeToArray('A1:' . $lastColumnTrueFalseData . $lastRowTrueFalseData, 0, true, false);
     //$produkteAufgaben->fromArray($aufgabenwerte, NULL, 'A1', true);
     $transponierteAufgabenwerte = PHPExcel_Calculation_LookupRef::TRANSPOSE($aufgabenwerte);
     $endmatrix = PHPExcel_Calculation_MathTrig::MMULT($transponierteAufgabenwerte, $aufgabenwerte);
     $richtigFalschProdukte->fromArray($endmatrix, NULL, 'A1', true);
     $lastColumnMMULTData = $richtigFalschProdukte->getHighestColumn();
     $lastRowMMULTData = $richtigFalschProdukte->getHighestRow();
     $maxColumn = $lastColumnMMULTData;
     $maxColumn++;
     $writeRow = $lastRowMMULTData + 2;
     for ($column = 'A'; $column != $maxColumn; $column++) {
         $cell = $richtigFalschProdukte->getCell($column . $writeRow);
         $cell->setValue('=SUM(' . $column . '1:' . $column . $lastRowMMULTData . ')');
     }
 }
开发者ID:kyro46,项目名称:TestStatisticsExport,代码行数:52,代码来源:class.ilTestStatisticsExportPlugin.php

示例3: addTransactionPage

 private function addTransactionPage(PHPExcel_Worksheet $activeSheet)
 {
     $activeSheet->setTitle('Транзакции')->setCellValue('A12', 'Статус')->setCellValue('B12', 'Тип')->setCellValue('C12', 'ID')->setCellValue('D12', 'Дата')->setCellValue('E12', 'IP')->setCellValue('F12', 'ГЕО')->setCellValue('G12', 'URL цели')->setCellValue('H12', 'Источник')->setCellValue('I12', 'Материал')->setCellValue('J12', 'Выплата')->setCellValue('K12', 'Вознаграждение')->setCellValue('L12', 'Зароботок')->setCellValue('M12', 'Цель');
     $row = 13;
     $availableStatuses = ActionsLog::getAvailableStatuses();
     foreach ($this->transactionData['rows'] as $tr) {
         $activeSheet->setCellValue('A' . $row, $availableStatuses[$tr['status']])->setCellValue('B' . $row, $tr['source_type_name'])->setCellValue('C' . $row, $tr['id'])->setCellValue('D' . $row, Yii::app()->dateFormatter->formatDateTime($tr['date']))->setCellValue('E' . $row, $tr['ip'])->setCellValue('F' . $row, $tr['geo'])->setCellValue('G' . $row, $tr['target_url_decoded'])->setCellValue('H' . $row, $tr['source_name'])->setCellValue('I' . $row, $tr['target_name'])->setCellValue('J' . $row, $tr['payment'])->setCellValue('K' . $row, $tr['reward'])->setCellValue('L' . $row, $tr['debit'])->setCellValue('M' . $row, $tr['action_name']);
         $row++;
     }
     $activeSheet->setCellValue('J' . $row, $this->transactionData['total']['payment'])->setCellValue('K' . $row, $this->transactionData['total']['reward'])->setCellValue('L' . $row, $this->transactionData['total']['debit']);
     $activeSheet->getColumnDimension('A')->setWidth(16.3 * 1.05);
     $activeSheet->getColumnDimension('B')->setWidth(16.43 * 1.05);
     $activeSheet->getColumnDimension('C')->setWidth(5 * 1.05);
     $activeSheet->getColumnDimension('D')->setWidth(17.86 * 1.05);
     $activeSheet->getColumnDimension('E')->setWidth(14.14 * 1.05);
     $activeSheet->getColumnDimension('F')->setWidth(34 * 1.05);
     $activeSheet->getColumnDimension('G')->setWidth(31 * 1.05);
     $activeSheet->getColumnDimension('H')->setWidth(30.86 * 1.05);
     $activeSheet->getColumnDimension('I')->setWidth(19.14 * 1.05);
     $activeSheet->getColumnDimension('J')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('K')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('L')->setWidth(8.57 * 1.05);
     $activeSheet->getColumnDimension('M')->setWidth(30.7 * 1.05);
     $activeSheet->getStyle('A12:M' . $row)->getAlignment()->setWrapText(true);
     $this->formatTable($activeSheet, 'A', '12', 'M', $row, array('formatTotal' => true, 'innerRowHeight' => -1, 'headerRowHeight' => 27));
     $this->addLogo($activeSheet);
     $this->setHeader($activeSheet, $this->getHeaders());
     $this->setPageFit($activeSheet, self::FIT_TO_WIDTH, PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
 }
开发者ID:kbudylov,项目名称:ttarget,代码行数:29,代码来源:ExcelReportTransactions.php

示例4: initialize

 /**
  * initial PHPExcel settings; build $this->activeColumns_arr
  */
 protected function initialize()
 {
     $this->sheet = $this->setActiveSheetIndex(0);
     $this->sheet->setTitle("Export");
     // build $this->activeColumns_arr:
     $columns_dict = $this->columns_dict;
     unset($columns_dict['cleared']);
     // <- cannot be toggled - so for now, don't show it at all
     $this->activeColumns_arr = array_keys(array_filter($columns_dict, function ($active) {
         return $active;
     }));
     // convert strftime format to Excel date/time formats:
     $this->dateFormat = str_replace('%', '', $this->kga['conf']['date_format_1']);
     // preferring the configurable value over $this->dateformat (hardcoded)
     $this->dateFormat = str_replace('y', 'yy', $this->dateFormat);
     $this->dateFormat = str_replace('Y', 'yyyy', $this->dateFormat);
     $this->dateFormat = str_replace('d', 'dd', $this->dateFormat);
     $this->dateFormat = str_replace('a', 'ddd', $this->dateFormat);
     $this->dateFormat = str_replace('w', 'dddd', $this->dateFormat);
     $this->dateFormat = str_replace('m', 'mm', $this->dateFormat);
     $this->timeFormat = str_replace('%', '', $this->customTimeformat);
     // $this->custom_timeformat is currently hardcoded - but it's better than nothing
     $this->timeFormat = str_replace('H', 'hh', $this->timeFormat);
     $this->timeFormat = str_replace('M', 'mm', $this->timeFormat);
     $this->timeFormat = str_replace('S', 'ss', $this->timeFormat);
     $this->timeFormat = str_replace('I', 'hh', $this->timeFormat);
     $this->timeFormat = str_replace('p', 'AM/PM', $this->timeFormat);
 }
开发者ID:kimai,项目名称:kimai,代码行数:31,代码来源:ExcelExporter.php

示例5: prepararArchivo

/**
 * 
 * @param PHPExcel_Worksheet $hoja
 * @param int $pk representa el índice de la columna en el archivo de excel que está asociada con la llave primaria de la tabla
 * @return string rerpesenta el nombre la ruta del archivo creado. Si no se pudo crear el archivo se regresa otra cosa :p
 */
function prepararArchivo($hoja, $pk = false, $incluirPrimeraFila = false)
{
    $objetoExcel = new PHPExcel();
    $hojaInsertar = $objetoExcel->getSheet(0);
    $hojaInsertar->setTitle('Insertar');
    if ($objetoExcel->getSheetCount() > 1) {
        $hojaActualizar = $objetoExcel->getSheet(1);
        $hojaActualizar->setTitle('Actualizar');
    } else {
        $hojaActualizar = new PHPExcel_Worksheet();
        $hojaActualizar->setTitle('Actualizar');
        $objetoExcel->addSheet($hojaActualizar);
    }
    $rango = $hoja->calculateWorksheetDataDimension();
    if (!$incluirPrimeraFila) {
        $rango[1] = '2';
    }
    $contenidoExcel = $hoja->rangeToArray($rango);
    $datos = array();
    $datos['insertar'] = array();
    $datos['actualizar'] = array();
    if ($pk) {
        $db = new DbConnection();
        $db->abrirConexion();
        $llavePrimaria = $_SESSION['pk'];
        foreach ($contenidoExcel as $fila) {
            $existe = $db->existeRegistro($_SESSION['tabla'], $llavePrimaria, $fila[$pk]);
            if ($existe) {
                $datos['actualizar'][] = $fila;
            } else {
                $datos['insertar'][] = $fila;
            }
        }
        $db->cerrarConexion();
    } else {
        foreach ($contenidoExcel as $fila) {
            $datos['insertar'][] = $fila;
        }
    }
    $hojaInsertar->fromArray($datos['insertar'], null, 'A1', true);
    $hojaActualizar->fromArray($datos['actualizar'], null, 'A1', true);
    $escritorExcel = PHPExcel_IOFactory::createWriter($objetoExcel, 'Excel2007');
    $escritorExcel->save('excelTmp/tmp_import_upload.xlsx');
    return 'excelTmp/tmp_import_upload.xlsx';
}
开发者ID:roy1336,项目名称:ImportadorPHP,代码行数:51,代码来源:lectorExcel.php

示例6: getReadDataOnly


//.........这里部分代码省略.........
                    $bottom->getColor()->setRGB($borderBottomColor['rgb']);
                }
                if (isset($left->colorIndex)) {
                    $borderLeftColor = self::_readColor($left->colorIndex, $this->_palette, $this->_version);
                    $left->getColor()->setRGB($borderLeftColor['rgb']);
                }
                if (isset($diagonal->colorIndex)) {
                    $borderDiagonalColor = self::_readColor($diagonal->colorIndex, $this->_palette, $this->_version);
                    $diagonal->getColor()->setRGB($borderDiagonalColor['rgb']);
                }
            }
        }
        // treat MSODRAWINGGROUP records, workbook-level Escher
        if (!$this->_readDataOnly && $this->_drawingGroupData) {
            $escherWorkbook = new PHPExcel_Shared_Escher();
            $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook);
            $escherWorkbook = $reader->load($this->_drawingGroupData);
            // debug Escher stream
            //$debug = new Debug_Escher(new PHPExcel_Shared_Escher());
            //$debug->load($this->_drawingGroupData);
        }
        // Parse the individual sheets
        foreach ($this->_sheets as $sheet) {
            if ($sheet['sheetType'] != 0x0) {
                // 0x00: Worksheet, 0x02: Chart, 0x06: Visual Basic module
                continue;
            }
            // check if sheet should be skipped
            if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) {
                continue;
            }
            // add sheet to PHPExcel object
            $this->_phpSheet = $this->_phpExcel->createSheet();
            $this->_phpSheet->setTitle($sheet['name']);
            $this->_phpSheet->setSheetState($sheet['sheetState']);
            $this->_pos = $sheet['offset'];
            // Initialize isFitToPages. May change after reading SHEETPR record.
            $this->_isFitToPages = false;
            // Initialize drawingData
            $this->_drawingData = '';
            // Initialize objs
            $this->_objs = array();
            // Initialize shared formula parts
            $this->_sharedFormulaParts = array();
            // Initialize shared formulas
            $this->_sharedFormulas = array();
            // Initialize text objs
            $this->_textObjects = array();
            // Initialize cell annotations
            $this->_cellNotes = array();
            $this->textObjRef = -1;
            while ($this->_pos <= $this->_dataSize - 4) {
                $code = self::_GetInt2d($this->_data, $this->_pos);
                switch ($code) {
                    case self::XLS_Type_BOF:
                        $this->_readBof();
                        break;
                    case self::XLS_Type_PRINTGRIDLINES:
                        $this->_readPrintGridlines();
                        break;
                    case self::XLS_Type_DEFAULTROWHEIGHT:
                        $this->_readDefaultRowHeight();
                        break;
                    case self::XLS_Type_SHEETPR:
                        $this->_readSheetPr();
                        break;
开发者ID:Arikito,项目名称:webking.xt,代码行数:67,代码来源:Excel5.php

示例7: load


//.........这里部分代码省略.........
             // fill start and end color
             $startColor = $this->_readColor($objStyle->getFill()->startcolorIndex);
             $objStyle->getFill()->getStartColor()->setRGB($startColor['rgb']);
             $endColor = $this->_readColor($objStyle->getFill()->endcolorIndex);
             $objStyle->getFill()->getEndColor()->setRGB($endColor['rgb']);
             // border colors
             $borderTopColor = $this->_readColor($objStyle->getBorders()->getTop()->colorIndex);
             $objStyle->getBorders()->getTop()->getColor()->setRGB($borderTopColor['rgb']);
             $borderRightColor = $this->_readColor($objStyle->getBorders()->getRight()->colorIndex);
             $objStyle->getBorders()->getRight()->getColor()->setRGB($borderRightColor['rgb']);
             $borderBottomColor = $this->_readColor($objStyle->getBorders()->getBottom()->colorIndex);
             $objStyle->getBorders()->getBottom()->getColor()->setRGB($borderBottomColor['rgb']);
             $borderLeftColor = $this->_readColor($objStyle->getBorders()->getLeft()->colorIndex);
             $objStyle->getBorders()->getLeft()->getColor()->setRGB($borderLeftColor['rgb']);
         }
     }
     // treat MSODRAWINGGROUP records, workbook-level Escher
     if (!$this->_readDataOnly && $this->_drawingGroupData) {
         $escherWorkbook = new PHPExcel_Shared_Escher();
         $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook);
         $escherWorkbook = $reader->load($this->_drawingGroupData);
         // debug Escher stream
         //$debug = new Debug_Escher(new PHPExcel_Shared_Escher());
         //$debug->load($this->_drawingGroupData);
     }
     // Parse the individual sheets
     foreach ($this->_sheets as $sheet) {
         // check if sheet should be skipped
         if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) {
             continue;
         }
         // add sheet to PHPExcel object
         $this->_phpSheet = $this->_phpExcel->createSheet();
         $this->_phpSheet->setTitle($sheet['name']);
         $this->_phpSheet->setSheetState($sheet['sheetState']);
         $this->_pos = $sheet['offset'];
         // Initialize isFitToPages. May change after reading SHEETPR record.
         $this->_isFitToPages = false;
         // Initialize drawingData
         $this->_drawingData = '';
         // Initialize objs
         $this->_objs = array();
         // Initialize shared formula parts
         $this->_sharedFormulaParts = array();
         // Initialize shared formulas
         $this->_sharedFormulas = array();
         while ($this->_pos < $this->_dataSize) {
             $code = $this->_GetInt2d($this->_data, $this->_pos);
             switch ($code) {
                 case self::XLS_Type_BOF:
                     $length = $this->_GetInt2d($this->_data, $this->_pos + 2);
                     $recordData = substr($this->_data, $this->_pos + 4, $length);
                     // move stream pointer to next record
                     $this->_pos += 4 + $length;
                     // do not use this version information for anything
                     // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream
                     // offset: 2; size: 2; type of the following data
                     $substreamType = $this->_GetInt2d($recordData, 2);
                     if ($substreamType != self::XLS_Worksheet) {
                         break 2;
                     }
                     break;
                 case self::XLS_Type_PRINTGRIDLINES:
                     $this->_readPrintGridlines();
                     break;
                 case self::XLS_Type_DEFAULTROWHEIGHT:
开发者ID:omusico,项目名称:wildfire_php,代码行数:67,代码来源:Excel5.php

示例8: title

 /**
  * Worksheet title getter/setter
  */
 public function title($title = NULL)
 {
     if ($title === NULL) {
         return $this->_worksheet->getTitle();
     } else {
         $this->_worksheet->setTitle($title);
         return $this;
     }
 }
开发者ID:Vagabondtq,项目名称:kohana-phpexcel,代码行数:12,代码来源:worksheet.php

示例9: load


//.........这里部分代码省略.........
             $xf['borders']['bottom']['color'] = $this->_readColor($xf['borders']['bottom']['colorIndex']);
             $xf['borders']['left']['color'] = $this->_readColor($xf['borders']['left']['colorIndex']);
         }
         foreach ($this->_builtInStyles as &$builtInStyle) {
             // fonts
             $builtInStyle['font']['color'] = $this->_readColor($builtInStyle['font']['colorIndex']);
             // fill start and end color
             $builtInStyle['fill']['startcolor'] = $this->_readColor($builtInStyle['fill']['startcolorIndex']);
             $builtInStyle['fill']['endcolor'] = $this->_readColor($builtInStyle['fill']['endcolorIndex']);
             // border colors
             $builtInStyle['borders']['top']['color'] = $this->_readColor($builtInStyle['borders']['top']['colorIndex']);
             $builtInStyle['borders']['right']['color'] = $this->_readColor($builtInStyle['borders']['right']['colorIndex']);
             $builtInStyle['borders']['bottom']['color'] = $this->_readColor($builtInStyle['borders']['bottom']['colorIndex']);
             $builtInStyle['borders']['left']['color'] = $this->_readColor($builtInStyle['borders']['left']['colorIndex']);
         }
     }
     // treat MSODRAWINGGROUP records, workbook-level Escher
     if (!$this->_readDataOnly && $this->_drawingGroupData) {
         $escherWorkbook = new PHPExcel_Shared_Escher();
         $reader = new PHPExcel_Reader_Excel5_Escher($escherWorkbook);
         $escherWorkbook = $reader->load($this->_drawingGroupData);
         // debug Escher stream
         //$debug = new Debug_Escher(new PHPExcel_Shared_Escher());
         //$debug->load($this->_drawingGroupData);
     }
     // Parse the individual sheets
     foreach ($this->_sheets as $sheet) {
         // check if sheet should be skipped
         if (isset($this->_loadSheetsOnly) && !in_array($sheet['name'], $this->_loadSheetsOnly)) {
             continue;
         }
         // add sheet to PHPExcel object
         $this->_phpSheet = $this->_phpExcel->createSheet();
         $this->_phpSheet->setTitle($sheet['name']);
         // default style
         if (!$this->_readDataOnly && isset($this->_builtInStyles[0])) {
             $this->_phpSheet->getDefaultStyle()->applyFromArray($this->_builtInStyles[0]);
         }
         $this->_pos = $sheet['offset'];
         // Initialize isFitToPages. May change after reading SHEETPR record.
         $this->_isFitToPages = false;
         // Initialize drawingData
         $this->_drawingData = '';
         // Initialize objs
         $this->_objs = array();
         while ($this->_pos < $this->_dataSize) {
             $code = $this->_GetInt2d($this->_data, $this->_pos);
             switch ($code) {
                 case self::XLS_Type_BOF:
                     $length = $this->_GetInt2d($this->_data, $this->_pos + 2);
                     $recordData = substr($this->_data, $this->_pos + 4, $length);
                     // move stream pointer to next record
                     $this->_pos += 4 + $length;
                     // do not use this version information for anything
                     // it is unreliable (OpenOffice doc, 5.8), use only version information from the global stream
                     // offset: 2; size: 2; type of the following data
                     $substreamType = $this->_GetInt2d($recordData, 2);
                     if ($substreamType != self::XLS_Worksheet) {
                         break 2;
                     }
                     break;
                 case self::XLS_Type_PRINTGRIDLINES:
                     $this->_readPrintGridlines();
                     break;
                 case self::XLS_Type_DEFAULTROWHEIGHT:
                     $this->_readDefaultRowHeight();
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:67,代码来源:Excel5.php

示例10: setTitle

 /**
  * Set title
  *
  * @param string $pValue String containing the dimension of this worksheet
  * @param string $updateFormulaCellReferences bool Flag indicating whether cell references in formulae should
  * be updated to reflect the new sheet name.
  * This should be left as the default true, unless you are
  * certain that no formula cells on any worksheet contain
  * references to this worksheet
  * @return Worksheet
  */
 public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true)
 {
     $this->sheet->setTitle($pValue, $updateFormulaCellReferences);
     return $this;
 }
开发者ID:meridius,项目名称:phpexcel,代码行数:16,代码来源:Worksheet.php

示例11: PHPExcel

$objPHPExcel->getProperties()->setTitle("Raumbelegungsplan")->setSubject("Ferienschule")->setDescription("Belegungsplan für die einzelnen Räume");
$objPHPExcel = new PHPExcel();
//$objPHPExcel->setActiveSheetIndex(0);
$days = array("Mo", "Di", "Mi", "Do", "Fr");
$slots = array(1, 2, 3);
$times = array("9:00-\n10:30", "10:45-\n12:15", "12:30-\n14:00");
$cells = array('A', 'B', 'C', 'D', 'C', 'D', 'E', 'F', 'G');
$sql_rooms = "SELECT * from rooms";
//$rooms = mysqli_query($conn, $sql_rooms) or trigger_error("Query Failed! SQL: $sql - Error: ".mysqli_error('ferienschule'), E_USER_ERROR);
$rooms = get_sql_result($sql_rooms);
$sheet = 1;
while ($room = mysqli_fetch_assoc($rooms)) {
    //create new worksheet for every room and make it active
    $objWorksheet = new PHPExcel_Worksheet($objPHPExcel);
    $objWorksheet->setTitle('' . $room["room_name"]);
    $objPHPExcel->addSheet($objWorksheet);
    $objPHPExcel->setActiveSheetIndex($sheet);
    $sheet++;
    $rowHeight = 130;
    $columnWidth = 60;
    $objPHPExcel->getActiveSheet()->getRowDimension('2')->setRowHeight(20);
    $objPHPExcel->getActiveSheet()->getRowDimension('3')->setRowHeight($rowHeight);
    $objPHPExcel->getActiveSheet()->getRowDimension('4')->setRowHeight($rowHeight);
    $objPHPExcel->getActiveSheet()->getRowDimension('5')->setRowHeight($rowHeight);
    $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth($columnWidth);
    $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth($columnWidth);
    $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth($columnWidth);
    $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth($columnWidth);
    $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth($columnWidth);
    $rowCount = 1;
开发者ID:blobfisch,项目名称:Ferienschule,代码行数:30,代码来源:raumbelegung.php

示例12: testGetSheetCount

 /**
  * @covers cymapgt\core\application\spreadsheet\SpreadsheetProcessor\SpreadsheetProcessor::getSheetCount
  */
 public function testGetSheetCount()
 {
     $this->assertInternalType('int', $this->object->getSheetCount());
     $this->assertEquals(1, $this->object->getSheetCount());
     //add the worksheet
     $wSheetObj = new \PHPExcel_Worksheet();
     $wSheetObj->setTitle('Worksheet2');
     $external = false;
     $index = true;
     $this->object->addSheet($wSheetObj, $external, $index);
     $this->assertEquals(2, $this->object->getSheetCount());
     //add the second worksheet
     $wSheetObj2 = new \PHPExcel_Worksheet();
     $wSheetObj2->setTitle('Worksheet3');
     $external2 = false;
     $index2 = true;
     $this->object->addSheet($wSheetObj2, $external2, $index2);
     $this->assertEquals(3, $this->object->getSheetCount());
     $this->object->removeSheet(2);
     $this->assertEquals(2, $this->object->getSheetCount());
 }
开发者ID:cymapgt,项目名称:spreadsheetprocessor,代码行数:24,代码来源:SpreadsheetProcessorTest.php

示例13: export_Uncomplete

 public function export_Uncomplete($file_name, $test = false)
 {
     error_reporting(E_ALL);
     ini_set("display_errors", 1);
     ini_set('max_execution_time', 60);
     ini_set('memory_limit', '256M');
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
     $cacheSettings = array('memoryCacheSize ' => '256MB');
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
     $this->excel = new PHPExcel();
     $registrant_data = $this->getArrayData();
     $worksheet = new PHPExcel_Worksheet();
     $worksheet->setTitle('Data');
     $worksheet->setCellValue('A1', 'Nomor Pendaftaran');
     $worksheet->getColumnDimension('A')->setAutoSize(true);
     $worksheet->setCellValue('B1', 'Nama');
     $worksheet->getColumnDimension('B')->setAutoSize(true);
     $worksheet->setCellValue('C1', 'I/A');
     $worksheet->getColumnDimension('C')->setAutoSize(true);
     $worksheet->setCellValue('D1', 'Asal Sekolah');
     $worksheet->getColumnDimension('D')->setAutoSize(true);
     $worksheet->setCellValue('E1', 'Contact');
     $worksheet->getColumnDimension('E')->setAutoSize(true);
     $worksheet->setCellValue('F1', 'Status Kekurangan');
     $worksheet->getColumnDimension('F')->setAutoSize(true);
     $row_iterate = 2;
     foreach ($registrant_data as $registrant) {
         if (!$registrant['completed']) {
             $row = [];
             $row[] = $registrant['id'];
             $row[] = strtoupper($registrant['name']);
             $row[] = $registrant['gender'] == 'L' ? 'Ikhwan' : 'Akhwat';
             $row[] = strtoupper($registrant['previousSchool']);
             $row[] = $registrant['cp'];
             $row[] = $registrant['status'];
             $worksheet->fromArray($row, '', 'A' . $row_iterate);
             $row_iterate++;
         }
     }
     $this->excel->removeSheetByIndex(0);
     $this->excel->addSheet($worksheet);
     if ($test) {
         return true;
     } else {
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="' . $file_name . '.xls"');
         header('Cache-Control: max-age=0');
         $objWriter = new PHPExcel_Writer_Excel5($this->excel);
         $objWriter->save('php://output');
         exit;
     }
 }
开发者ID:s4if,项目名称:ppdb-sma,代码行数:52,代码来源:Model_registrant.php


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