本文整理汇总了PHP中PHPExcel_Style_Font::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style_Font::setName方法的具体用法?PHP PHPExcel_Style_Font::setName怎么用?PHP PHPExcel_Style_Font::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Style_Font
的用法示例。
在下文中一共展示了PHPExcel_Style_Font::setName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setStyle
public function setStyle($cellRange, $fontFamily = 'Arial', $fontSize = 10, $colorRGB = '00000000', $bold = false, $italic = false, $underline = false)
{
require_once \GO::config()->root_path . 'go/vendor/PHPExcel/PHPExcel/Style.php';
require_once \GO::config()->root_path . 'go/vendor/PHPExcel/PHPExcel/Style/Font.php';
require_once \GO::config()->root_path . 'go/vendor/PHPExcel/PHPExcel/Style/Color.php';
$colorObj = new \PHPExcel_Style_Color();
$colorObj->setRGB($colorRGB);
$fontObj = new \PHPExcel_Style_Font();
$fontObj->setName($fontFamily);
$fontObj->setSize($fontSize);
$fontObj->setColor($colorObj);
$fontObj->setBold($bold);
$fontObj->setItalic($italic);
$fontObj->setUnderline($underline);
$styleObj = new \PHPExcel_Style();
$styleObj->setFont($fontObj);
$this->getActiveSheet()->setSharedStyle($styleObj, $cellRange);
}
示例2: generateadvchecklist
private function generateadvchecklist($advlist)
{
//Set column dimensions
$advlist->getColumnDimension('A')->setWidth(65);
for ($i = 'B'; $i < 'Q'; $i++) {
$advlist->getColumnDimension("{$i}")->setWidth(6.5);
}
//Set Styles for cells
$advlist->getStyle("A1:P14")->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$advlist->getStyle("A1:P14")->getFont()->setBold(true);
$advlist->getStyle("A1:P2")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$advlist->getStyle("A1:P2")->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$advlist->getStyle("A1:A14")->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
//Set background for header cells
$advlist->getStyle("B1:P2")->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('EEEEEE');
$advlist->getStyle("A3:A14")->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('EEEEEE');
//Set up top row (header) cells
$advlist->mergeCells("A1:A2");
for ($y = 0, $fc = 'B', $lc = 'D'; $y < 5; $y++) {
$advlist->mergeCells("{$fc}" . '1:' . "{$lc}" . '1');
$advlist->getCell("{$fc}" . '2')->setValue("F");
$fc++;
$lc++;
$advlist->getCell("{$fc}" . '2')->setValue("W");
$fc++;
$lc++;
$advlist->getCell("{$fc}" . '2')->setValue("Sp");
$fc++;
$lc++;
}
//Set text for row titles (Should be hard coded)
$advlist->getStyle("A1:A14")->getAlignment()->setWrapText(true);
$advlist->getCell("A14")->SetValue("The student has been released on BOSS or CICS screen 7R3.");
$advlist->getCell("A1")->setValue("Put your initials in the appropriate cell when completed");
$advlist->getCell("A3")->SetValue("The term, year, and grade of courses already taken have been updated on the check sheet.");
//Style needed for EVERY (9) following rich text run
$fontstyle = new PHPExcel_Style_Font();
$fontstyle->setName("Arial")->setSize(10)->setBold(true);
//Cell A4 -- A lot of code to make a single word green
$text = new PHPExcel_RichText();
$run1 = $text->createTextRun("The term and year of current (ongoing) courses have been highlighted in ");
$run1->setFont($fontstyle);
$run2 = $text->createTextRun("green");
$run2->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_GREEN))->setName("Arial")->setSize(10)->setBold(true);
$run3 = $text->createTextRun(" on the check sheet.");
$run3->setFont($fontstyle);
$advlist->getCell("A4")->SetValue($text);
//Cell A5 -- A lot of code to make a single word yellow
$text = new PHPExcel_RichText();
$run1 = $text->createTextRun("The term and year of courses scheduled for the next term are highlighted in ");
$run1->setFont($fontstyle);
$run2 = $text->createTextRun("yellow");
$run2->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_YELLOW))->setName('Arial')->setSize(10)->setBold(true);
$run3 = $text->createTextRun(" on the check sheet.");
$run3->setFont($fontstyle);
$advlist->getCell("A5")->SetValue($text);
//Cell A6 -- A lot of code to make a single word red
$text = new PHPExcel_RichText();
$run1 = $text->createTextRun("Problems have been highlighted in ");
$run1->setFont($fontstyle);
$run2 = $text->createTextRun("red");
$run2->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_RED))->setName('Arial')->setSize(10)->setBold(true);
$run3 = $text->createTextRun(" on the check sheet and have been discussed with the student.");
$run3->setFont($fontstyle);
$advlist->getCell("A6")->SetValue($text);
$advlist->getCell("A7")->SetValue("All course substitutions have been approved either in the system (BOSS/CICS) or by the Program Chair.");
$advlist->getCell("A8")->SetValue("The student has taken all COES prerequisites (and earned a 'C' or better) for all COES courses on the advisement sheet.");
$advlist->getCell("A9")->SetValue("The student was informed of the requirement for a minimum 2.0 GPA on all CSC courses, including all attempts.");
$advlist->getCell("A10")->SetValue("The student was informed of the requirement for a minimum 2.0 GPA on the MATH 240 series, including all attempts.");
$advlist->getCell("A11")->SetValue("A sanity check was done to ensure that the student doesn't get into trouble with once-a-year classes and is subsequently unduly delayed.");
$advlist->getCell("A12")->SetValue("All deviances have been documented on a completed petition (one copy has been put in the Program Chair's box, and one copy has been sent to the Associate Dean of Undergraduate Studies).");
$advlist->getCell("A13")->SetValue("The check sheet has been uploaded/copied to the cloud space.");
$advlist->getCell("A14")->SetValue("The student has been released on BOSS or CICS screen 7R3.");
//Set row heights
// There's an issue with excel
// A row can't have autosized height, so it must be hard coded
$advlist->getRowDimension(3)->setRowHeight(14 * 2);
$advlist->getRowDimension(4)->setRowHeight(14 * 2);
$advlist->getRowDimension(5)->setRowHeight(14 * 2);
$advlist->getRowDimension(6)->setRowHeight(14 * 2);
$advlist->getRowDimension(7)->setRowHeight(14 * 2);
$advlist->getRowDimension(8)->setRowHeight(14 * 2);
$advlist->getRowDimension(9)->setRowHeight(14 * 2);
$advlist->getRowDimension(10)->setRowHeight(14 * 2);
$advlist->getRowDimension(11)->setRowHeight(14 * 2);
$advlist->getRowDimension(12)->setRowHeight(14 * 3);
$advlist->getRowDimension(13)->setRowHeight(14 * 1);
$advlist->getRowDimension(14)->setRowHeight(14 * 1);
}
示例3: substr
case 0x2:
// 2 byte signed integer
$value = self::_GetInt2d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
break;
case 0x3:
// 4 byte signed integer
$value = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
break;
case 0x13:
// 4 byte unsigned integer
// not needed yet, fix later if necessary
break;
case 0x1e:
// null-terminated string prepended by dword string length
$byteLength = self::_GetInt4d($this->_documentSummaryInformation, $secOffset + 4 + $offset);
$value = substr($this->_documentSummaryInformation, $secOffset + 8 + $offset, $byteLength);
$value = PHPExcel_Shared_String::ConvertEncoding($value, 'UTF-8', $codePage);
$value = rtrim($value);
break;
case 0x40:
// Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
// PHP-Time
$value = PHPExcel_Shared_OLE::OLE2LocalDate(substr($this->_documentSummaryInformation, $secOffset + 4 + $offset, 8));
break;
case 0x47:
// Clipboard format
// not needed yet, fix later if necessary
break;
}
switch ($id) {
case 0x1:
// Code Page
$codePage = PHPExcel_Shared_CodePage::NumberToName($value);
break;
case 0x2:
// Category
$this->_phpExcel->getProperties()->setCategory($value);
break;
case 0x3:
// Presentation Target
// Not supported by PHPExcel
break;
case 0x4:
// Bytes
// Not supported by PHPExcel
break;
case 0x5:
// Lines
// Not supported by PHPExcel
break;
case 0x6:
// Paragraphs
// Not supported by PHPExcel
break;
case 0x7:
// Slides
// Not supported by PHPExcel
break;
case 0x8:
// Notes
// Not supported by PHPExcel
break;
case 0x9:
// Hidden Slides
// Not supported by PHPExcel
break;
case 0xa:
// MM Clips
// Not supported by PHPExcel
break;
case 0xb:
// Scale Crop
// Not supported by PHPExcel
break;
case 0xc:
// Heading Pairs
// Not supported by PHPExcel
break;