本文整理匯總了PHP中unknown::getActiveSheet方法的典型用法代碼示例。如果您正苦於以下問題:PHP unknown::getActiveSheet方法的具體用法?PHP unknown::getActiveSheet怎麽用?PHP unknown::getActiveSheet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類unknown
的用法示例。
在下文中一共展示了unknown::getActiveSheet方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: printHeaders
/**
*
* @param unknown $objPHPExcel
* @param unknown $cols
*/
private static function printHeaders($objPHPExcel, $cols)
{
$count = 1;
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow(0, 2, "Data");
foreach ($cols as $col) {
$objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($count++, 2, sprintf("%7s", $col));
}
}
示例2: newSheet
/**
*
* @param unknown $objPHPExcel
*/
static function newSheet($objPHPExcel, $index = -1)
{
if ($index < 0) {
$index = $objPHPExcel->getSheetCount();
}
$objPHPExcel->createSheet($index);
$objPHPExcel->setActiveSheetIndex($index);
$sheet = $objPHPExcel->getActiveSheet();
return $sheet;
}
示例3: setCENTER
/**
* 設置單元格對齊
* @param unknown $objPHPExcel
* @param unknown $CellString
* @param string $isRight 是否居右對其
*/
private function setCENTER($objPHPExcel, $CellString, $isRight = flase, $isSetBorder = false)
{
$cellStyle = $objPHPExcel->getActiveSheet()->getStyle($CellString);
$cellAlignment = $cellStyle->getAlignment();
$cellAlignment->setVertical(\PHPExcel_Style_Alignment::VERTICAL_CENTER);
if ($isRight) {
$cellAlignment->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
} else {
$cellAlignment->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
}
if ($isSetBorder) {
$cellStyle->getBorders()->getTop()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
$cellStyle->getBorders()->getLeft()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
$cellStyle->getBorders()->getRight()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
$cellStyle->getBorders()->getBottom()->setBorderStyle(\PHPExcel_Style_Border::BORDER_THIN);
}
}