本文整理汇总了PHP中PHPExcel_Worksheet_Drawing::setRotation方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet_Drawing::setRotation方法的具体用法?PHP PHPExcel_Worksheet_Drawing::setRotation怎么用?PHP PHPExcel_Worksheet_Drawing::setRotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet_Drawing
的用法示例。
在下文中一共展示了PHPExcel_Worksheet_Drawing::setRotation方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
//.........这里部分代码省略.........
}
if ($xmlSheet->drawing && !$this->_readDataOnly) {
foreach ($xmlSheet->drawing as $drawing) {
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
if ($relsDrawing && $relsDrawing->Relationship) {
foreach ($relsDrawing->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
}
}
}
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
if ($xmlDrawing->oneCellAnchor) {
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
if ($oneCellAnchor->pic->blipFill) {
$blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing;
$objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad")));
$shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist")));
$shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir")));
$shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn"));
$shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val"));
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
}
}
}
if ($xmlDrawing->twoCellAnchor) {
foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
if ($twoCellAnchor->pic->blipFill) {
$blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing;
$objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy")));
示例2: load
//.........这里部分代码省略.........
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
if ($relsDrawing && $relsDrawing->Relationship) {
foreach ($relsDrawing->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
} elseif ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
if ($this->_includeCharts) {
$charts[self::dir_add($fileDrawing, $ele["Target"])] = array('id' => (string) $ele["Id"], 'sheet' => $docSheet->getTitle());
}
}
}
}
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
if ($xmlDrawing->oneCellAnchor) {
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
if ($oneCellAnchor->pic->blipFill) {
$blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://" . PHPExcel_Shared_File::realpath($pFilename) . "#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad")));
$shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist")));
$shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir")));
$shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn"));
$shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val"));
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
} else {
// ? Can charts be positioned with a oneCellAnchor ?
$coordinates = PHPExcel_Cell::stringFromColumnIndex((string) $oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1);
$offsetX = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff);
$offsetY = PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff);
$width = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx"));
$height = PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy"));
}
}
}
if ($xmlDrawing->twoCellAnchor) {
foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
if ($twoCellAnchor->pic->blipFill) {
$blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://" . PHPExcel_Shared_File::realpath($pFilename) . "#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
示例3: exportExcel
public function exportExcel($conf = array())
{
$data = $conf['data'];
$name = $conf['filename'] . '-' . date('Y-m-d H-i-s');
$field = explode(',', $conf['field'][0]);
$fieldtitle = explode(',', $conf['field'][1]);
$objPHPExcel = new \PHPExcel();
//以下是一些设置 ,什么作者 标题啊之类的
$objPHPExcel->getProperties()->setCreator("ainiku")->setLastModifiedBy("ainiku")->setTitle("feilv export")->setSubject("feilv export")->setDescription("bakdata")->setKeywords("excel")->setCategory("result file");
//设置表头
$obj = $objPHPExcel->setActiveSheetIndex(0);
$fieldnum = count($fieldtitle);
$j = 65;
foreach ($fieldtitle as $v) {
//
$obj->setCellValue(chr($j++) . '1', ' ' . $v);
}
//Set border colors 设置边框颜色
//$obj->freezePane(chr(65).'1:'.chr($j).'1');
$objPHPExcel->getActiveSheet()->getStyle('D13')->getBorders()->getLeft()->getColor()->setARGB('FF993300');
$objPHPExcel->getActiveSheet()->getStyle('D13')->getBorders()->getTop()->getColor()->setARGB('FF993300');
$objPHPExcel->getActiveSheet()->getStyle('D13')->getBorders()->getBottom()->getColor()->setARGB('FF993300');
$objPHPExcel->getActiveSheet()->getStyle('E13')->getBorders()->getRight()->getColor()->setARGB('FF993300');
//Set border colors 设置背景颜色
//$objPHPExcel->getActiveSheet()->getStyle(chr(65).'1:'.chr($j).'1')->getFill()->setFillType(\PHPExcel_Style_Fill::FILL_SOLID);
//$objPHPExcel->getActiveSheet()->getStyle(chr(65).'1:'.chr($j).'1')->getFill()->getStartColor()->setARGB('FFededed');
//以下就是对处理Excel里的数据, 横着取数据,主要是这一步,其他基本都不要改
// 固定第一行
$obj->freezePane('A1');
$fieldnum = count($field);
foreach ($data as $k => $v) {
$num = $k + 2;
$temfield = $field;
$j = 'A';
$i = 0;
//$obj=$objPHPExcel->setActiveSheetIndex(0);
for ($i; $i < $fieldnum; $i++) {
$temstr = array_shift($temfield);
if (substr($temstr, 0, 1) == "'") {
$temstr = str_replace("'", '', $temstr);
$obj->setCellValue($j . $num, ' ' . $v[$temstr]);
} else {
if (substr($temstr, 0, 5) == "#pic#") {
//插入图片
$temstr = str_replace("#pic#", '', $temstr);
$img = new \PHPExcel_Worksheet_Drawing();
$img->setPath($v[$temstr]);
//写入图片路径
$img->setHeight(100);
//写入图片高度
$img->setWidth(100);
//写入图片宽度
$img->setOffsetX(1);
//写入图片在指定格中的X坐标值
$img->setOffsetY(1);
//写入图片在指定格中的Y坐标值
$img->setRotation(1);
//设置旋转角度
$img->getShadow()->setVisible(true);
//
$img->getShadow()->setDirection(50);
//
$img->setCoordinates($j . $num);
//设置图片所在表格位置
//$objPHPExcel->getColumnDimension("$letter[$i]")->setWidth(20);
$obj->getDefaultRowDimension()->setRowHeight(100);
$img->setWorksheet($obj);
//把图片写到当前的表格中
//$objActSheet->getCell('E26')->getHyperlink()->setUrl( 'http://www.phpexcel.net'); //超链接url地址
//$objActSheet->getCell('E26')->getHyperlink()->setTooltip( 'Navigate to website'); //鼠标移上去连接提示信息
//$obj->setCellValue($j.$num, $img);
} else {
if (substr($temstr, 0, 6) == "#link#") {
$temstr = str_replace("#link#", '', $temstr);
$obj->setCellValue($j . $num, $v[$temstr]);
$obj->getCell($j . $num)->getHyperlink()->setUrl($v[$temstr]);
//超链接url地址
$obj->getCell($j . $num)->getHyperlink()->setTooltip($v[$temstr]);
//鼠标移上去连接提
} else {
$obj->setCellValue($j . $num, $v[$temstr]);
}
}
}
$j++;
}
}
$objPHPExcel->getActiveSheet()->setTitle('User');
$objPHPExcel->setActiveSheetIndex(0);
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="' . $name . '.xls"');
header('Cache-Control: max-age=0');
$objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
}
示例4: date
echo date('H:i:s'), " Add a drawing to the worksheet", EOL;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./images/officelogo.jpg');
$objDrawing->setHeight(36);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Add a drawing to the worksheet
echo date('H:i:s'), " Add a drawing to the worksheet", EOL;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Paid');
$objDrawing->setDescription('Paid');
$objDrawing->setPath('./images/paid.png');
$objDrawing->setCoordinates('B15');
$objDrawing->setOffsetX(110);
$objDrawing->setRotation(25);
$objDrawing->getShadow()->setVisible(true);
$objDrawing->getShadow()->setDirection(45);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Add a drawing to the worksheet
echo date('H:i:s'), " Add a drawing to the worksheet", EOL;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('PHPExcel logo');
$objDrawing->setDescription('PHPExcel logo');
$objDrawing->setPath('./images/phpexcel_logo.gif');
$objDrawing->setHeight(36);
$objDrawing->setCoordinates('D24');
$objDrawing->setOffsetX(10);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Play around with inserting and removing rows and columns
echo date('H:i:s'), " Play around with inserting and removing rows and columns", EOL;
示例5: load
//.........这里部分代码省略.........
}
}
if ($xmlSheet->drawing && !$this->_readDataOnly) {
foreach ($xmlSheet->drawing as $drawing) {
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$relsDrawing = simplexml_load_string($zip->getFromName(dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
if ($relsDrawing && $relsDrawing->Relationship) {
foreach ($relsDrawing->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
}
}
}
$xmlDrawing = simplexml_load_string($zip->getFromName($fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
if ($xmlDrawing->oneCellAnchor) {
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
if ($oneCellAnchor->pic->blipFill) {
$blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://{$pFilename}#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad")));
$shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist")));
$shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir")));
$shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn"));
$shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val"));
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
}
}
}
if ($xmlDrawing->twoCellAnchor) {
foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
if ($twoCellAnchor->pic->blipFill) {
$blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://{$pFilename}#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($twoCellAnchor->from->col) . ($twoCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes(), "cy")));
if ($xfrm) {
示例6: setHeaderLogo
/**
* set header logo;
*/
public function setHeaderLogo()
{
$headerLogo = BASEPATH . $this->setup->getSettingValue('config_logo');
switch ($this->driver) {
case 'excel2003':
//drawing
$drawing = new PHPExcel_Worksheet_Drawing();
$drawing->setName('Logo ');
$drawing->setDescription('Logo');
$drawing->setPath($headerLogo);
$drawing->setHeight(90);
$drawing->setCoordinates('A' . $this->currentRow);
$drawing->setOffsetX(90);
$drawing->setRotation(25);
$drawing->getShadow()->setVisible(true);
$drawing->getShadow()->setDirection(45);
$drawing->setWorksheet($this->rpt->getActiveSheet());
break;
case 'excel2007':
//drawing
$drawing = new PHPExcel_Worksheet_Drawing();
$drawing->setName('Logo');
$drawing->setDescription('Logo');
$drawing->setPath($headerLogo);
$drawing->setHeight(90);
$drawing->setCoordinates('A' . $this->currentRow);
$drawing->setOffsetX(10);
$drawing->setRotation(0);
$drawing->getShadow()->setVisible(true);
$drawing->getShadow()->setDirection(45);
$drawing->setWorksheet($this->rpt->getActiveSheet());
break;
}
}
示例7: outputExcel
public function outputExcel()
{
//设置PHPExcel类库的include path
App::import('Vendor', 'Classes/PHPExcel');
// 创建一个处理对象实例
$objExcel = new PHPExcel();
// 创建文件格式写入对象实例, uncomment
$objWriter = new PHPExcel_Writer_Excel5($objExcel);
// 用于其他版本格式
//or
//$objWriter = new PHPExcel_Writer_Excel2007($objExcel); // 用于 2007 格式
//$objWriter->setOffice2003Compatibility(true);
//设置文档基本属性
$objProps = $objExcel->getProperties();
$objProps->setCreator("Zeal Li");
$objProps->setLastModifiedBy("Zeal Li");
$objProps->setTitle("Office XLS Test Document");
$objProps->setSubject("Office XLS Test Document, Demo");
$objProps->setDescription("Test document, generated by PHPExcel.");
$objProps->setKeywords("office excel PHPExcel");
$objProps->setCategory("Test");
//设置当前的sheet索引,用于后续的内容操作。
//一般只有在使用多个sheet的时候才需要显示调用。
//缺省情况下,PHPExcel会自动创建第一个sheet被设置SheetIndex=0
$objExcel->setActiveSheetIndex(0);
$objActSheet = $objExcel->getActiveSheet();
//设置当前活动sheet的名称
$objActSheet->setTitle('测试Sheet');
//设置单元格内容 由PHPExcel根据传入内容自动判断单元格内容类型
$objActSheet->setCellValue('A1', '字符串内容');
// 字符串内容
$objActSheet->setCellValue('A2', 26);
// 数值
$objActSheet->setCellValue('A3', true);
// 布尔值
$objActSheet->setCellValue('A4', '=SUM(A2:A2)');
// 公式
//显式指定内容类型
$objActSheet->setCellValueExplicit('A5', '8757584', PHPExcel_Cell_DataType::TYPE_STRING);
//合并单元格
$objActSheet->mergeCells('B1:C22');
//分离单元格
$objActSheet->unmergeCells('B1:C22');
//设置宽度
$objActSheet->getColumnDimension('B')->setAutoSize(true);
$objActSheet->getColumnDimension('A')->setWidth(30);
//设置单元格内容的数字格式。
//如果使用了 PHPExcel_Writer_Excel5 来生成内容的话,
//这里需要注意,在 PHPExcel_Style_NumberFormat 类的 const 变量定义的
//各种自定义格式化方式中,其它类型都可以正常使用,但当setFormatCode
//为 FORMAT_NUMBER 的时候,实际出来的效果被没有把格式设置为"0"。需要
//修改 PHPExcel_Writer_Excel5_Format 类源代码中的 getXf($style) 方法,
//在 if ($this->_BIFF_version == 0x0500) { (第363行附近)前面增加一
//行代码:
//if($ifmt === '0') $ifmt = 1;
//设置格式为PHPExcel_Style_NumberFormat::FORMAT_NUMBER,避免某些大数字
//被使用科学记数方式显示,配合下面的 setAutoSize 方法可以让每一行的内容
//都按原始内容全部显示出来。
$objStyleA5 = $objActSheet->getStyle('A5');
$objStyleA5->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
//设置字体
$objFontA5 = $objStyleA5->getFont();
$objFontA5->setName('Courier New');
$objFontA5->setSize(10);
$objFontA5->setBold(true);
$objFontA5->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objFontA5->getColor()->setARGB('FFFF0000');
$objFontA5->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
// $ objFontA5 ->getFont()->setColor(PHPExcel_Style_Color::COLOR_RED);
//设置对齐方式
$objAlignA5 = $objStyleA5->getAlignment();
$objAlignA5->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objAlignA5->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
//设置边框
$objBorderA5 = $objStyleA5->getBorders();
$objBorderA5->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorderA5->getTop()->getColor()->setARGB('FFFF0000');
// 边框color
$objBorderA5->getBottom()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorderA5->getLeft()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objBorderA5->getRight()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
//设置CELL填充颜色
$objFillA5 = $objStyleA5->getFill();
$objFillA5->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objFillA5->getStartColor()->setARGB('FFEEEEEE');
//从指定的单元格复制样式信息.
$objActSheet->duplicateStyle($objStyleA5, 'B1:C22');
//添加图片
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('ZealImg');
$objDrawing->setDescription('Image inserted by Zeal');
$objDrawing->setPath('./zeali.net.logo.gif');
$objDrawing->setHeight(36);
$objDrawing->setCoordinates('C23');
$objDrawing->setOffsetX(10);
$objDrawing->setRotation(15);
$objDrawing->getShadow()->setVisible(true);
$objDrawing->getShadow()->setDirection(36);
$objDrawing->setWorksheet($objActSheet);
//添加一个新的worksheet
//.........这里部分代码省略.........
示例8: PHPExcel
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
//Set PHPExcel Properties
$objPHPExcel->getProperties()->setCreator("{$PurchaseHead}")->setLastModifiedBy("{$PurchaseHead}")->setTitle("{$CurrPOID}")->setSubject("{$CurrPOID}")->setDescription("{$CurrPOID} Excel File")->setKeywords("{$CurrPOID}")->setCategory("{$CurrPOID}");
$cell_row = 9;
//Set Defaults
$objPHPExcel->getActiveSheet()->getDefaultColumnDimension()->setWidth(10);
$objPHPExcel->getActiveSheet()->getDefaultRowDimension()->setRowHeight(15);
//Set Purchase Order Logo
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('../styles/images/po_logo.jpg');
$objDrawing->setCoordinates('A1');
$objDrawing->setOffsetX(100);
$objDrawing->setRotation(0);
$objDrawing->setHeight(180);
$objDrawing->setWidth(470);
$objDrawing->getShadow()->setVisible(false);
$objDrawing->getShadow()->setDirection(0);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
//PO Number
$cell_row += 1;
$PurchaseNo = stripslashes($PurchaseNo);
$objPHPExcel->getActiveSheet()->mergeCells("A{$cell_row}:E{$cell_row}");
$objPHPExcel->getActiveSheet()->setCellValue("A{$cell_row}", "No. {$PurchaseNo}");
//PO Number Formatting
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(50);
$objPHPExcel->getActiveSheet()->getStyle("A{$cell_row}:E{$cell_row}")->getFont()->setName('Calibri');
$objPHPExcel->getActiveSheet()->getStyle("A{$cell_row}:E{$cell_row}")->getFont()->setSize(11);
$objPHPExcel->getActiveSheet()->getStyle("A{$cell_row}:E{$cell_row}")->getFont()->setBold(true);
示例9: load
//.........这里部分代码省略.........
if (isset($hyperlink['tooltip'])) {
$docSheet->getCell($hyperlink['ref'])->getHyperlink()->setTooltip((string) $hyperlink['tooltip']);
}
}
}
}
// Add comments
$comments = array();
if (!$this->_readDataOnly) {
// Locate comment relations
if ($zip->locateName(dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
$relsWorksheet = simplexml_load_string($zip->getFromName(dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
$comments[(string) $ele["Id"]] = (string) $ele["Target"];
}
}
}
// Loop trough comments
foreach ($comments as $relName => $relPath) {
// Load comments file
$relPath = PHPExcel_Shared_File::realpath(dirname("{$dir}/{$fileWorksheet}") . "/" . $relPath);
$commentsFile = simplexml_load_string($zip->getFromName($relPath));
// Utility variables
$authors = array();
// Loop trough authors
foreach ($commentsFile->authors->author as $author) {
$authors[] = (string) $author;
}
// Loop trough contents
foreach ($commentsFile->commentList->comment as $comment) {
$docSheet->getComment((string) $comment['ref'])->setAuthor($authors[(string) $comment['authorId']]);
$docSheet->getComment((string) $comment['ref'])->setText($this->_parseRichText($comment->text));
}
}
}
// TODO: Make sure drawings and graph are loaded differently!
if ($zip->locateName(dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
$relsWorksheet = simplexml_load_string($zip->getFromName(dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$drawings = array();
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
$drawings[(string) $ele["Id"]] = self::dir_add("{$dir}/{$fileWorksheet}", $ele["Target"]);
}
}
if ($xmlSheet->drawing && !$this->_readDataOnly) {
foreach ($xmlSheet->drawing as $drawing) {
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$relsDrawing = simplexml_load_string($zip->getFromName(dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
foreach ($relsDrawing->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
}
}
$xmlDrawing = simplexml_load_string($zip->getFromName($fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
$blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://{$pFilename}#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad")));
$shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist")));
$shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir")));
$shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn"));
$shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val"));
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
}
}
}
}
}
if (!$this->_readDataOnly) {
$excel->setActiveSheetIndex(intval($xmlWorkbook->bookView->workbookView["activeTab"]));
}
break;
}
}
return $excel;
}
示例10: generar_reporte_disponibilidad
private function generar_reporte_disponibilidad($mes, $year)
{
if (!$year || $year === '%') {
$year = date("Y");
}
if (!$mes || $mes === '%' || $mes == -1) {
$mes = date("m");
}
$temp = $year . '-' . $mes . '%';
$proveedores = $this->proveedores_disponibilidad($mes, $year);
// Create new PHPExcel object
$this->load->library('phpexcel');
// Set document properties
$this->phpexcel->getProperties()->setCreator("PHPExcel")->setLastModifiedBy("PHPExcel")->setTitle("Office 2007 XLSX Report Document")->setSubject("Office 2007 XLSX Report Document")->setDescription("Report document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Report result file");
// Add some data in row 2
$this->phpexcel->getActiveSheet()->setCellValue('B2', 'DIRECCION PROVINCIAL DE ECONOMIA Y PLANIFICACION');
$this->phpexcel->getActiveSheet()->getStyle('B2')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B2:F2');
$this->phpexcel->getActiveSheet()->getColumnDimension('A')->setWidth(2);
$this->phpexcel->getActiveSheet()->getColumnDimension('B')->setWidth(40);
$this->phpexcel->getActiveSheet()->getColumnDimension('D')->setWidth(15);
$this->phpexcel->getActiveSheet()->getColumnDimension('F')->setWidth(30);
$this->phpexcel->getActiveSheet()->getStyle('B2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->phpexcel->getActiveSheet()->getStyle('B2')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B2')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B2:F2')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 3
$this->phpexcel->getActiveSheet()->setCellValue('B3', 'CAMAGÜEY');
$this->phpexcel->getActiveSheet()->getStyle('B3')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B3:F3');
$this->phpexcel->getActiveSheet()->getStyle('B3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->phpexcel->getActiveSheet()->getStyle('B3')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B3')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B3:F3')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 4
$this->phpexcel->getActiveSheet()->setCellValue('B4', 'San Pablo # 104 % Martí y Luaces Tel. 295637');
$this->phpexcel->getActiveSheet()->getStyle('B4')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B4:F4');
$this->phpexcel->getActiveSheet()->getStyle('B4')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->phpexcel->getActiveSheet()->getStyle('B4')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B4')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B4:F4')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 5
$this->phpexcel->getActiveSheet()->setCellValue('B5', 'Email:boletas@dpepcmg.mep.gov.cu');
$this->phpexcel->getActiveSheet()->getStyle('B5')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B5:F5');
$this->phpexcel->getActiveSheet()->getStyle('B5')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$this->phpexcel->getActiveSheet()->getStyle('B5')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B5')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B5:F5')->applyFromArray($this->styles('blackStyle'));
// Add a drawing to the worksheet
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Paid');
$objDrawing->setDescription('Paid');
$objDrawing->setPath('./web/images/dpep.png');
$objDrawing->setCoordinates('B3');
$objDrawing->setOffsetX(25);
$objDrawing->setRotation(0);
$objDrawing->getShadow()->setVisible(true);
$objDrawing->getShadow()->setDirection(45);
$objDrawing->setWorksheet($this->phpexcel->getActiveSheet());
// Add some data in row 6
$this->phpexcel->getActiveSheet()->setCellValue('B6', PHPExcel_Shared_Date::PHPToExcel(gmmktime(0, 0, 0, date('m'), date('d'), date('Y'))));
$this->phpexcel->getActiveSheet()->getStyle('B6')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15);
$this->phpexcel->getActiveSheet()->getStyle('B6')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B6:F6');
$this->phpexcel->getActiveSheet()->getStyle('B6')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$this->phpexcel->getActiveSheet()->getStyle('B6')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B6')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B6:F6')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 7
$this->phpexcel->getActiveSheet()->getStyle('B7')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->mergeCells('B7:F7');
$this->phpexcel->getActiveSheet()->getStyle('B7')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
$this->phpexcel->getActiveSheet()->getStyle('B7')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B7')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B7:F7')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 8
$this->phpexcel->getActiveSheet()->setCellValue('B8', 'DISPONIBILIDAD DE LA RESERVA DEL CAP');
$this->phpexcel->getActiveSheet()->getStyle('B8')->getFont()->setSize(14);
$this->phpexcel->getActiveSheet()->mergeCells('B8:F8');
$this->phpexcel->getActiveSheet()->getStyle('B8')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->phpexcel->getActiveSheet()->getStyle('B8')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B8')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B8:F8')->applyFromArray($this->styles('blackStyle'));
// Add some data in row 9
$this->phpexcel->getActiveSheet()->setCellValue('B9', 'PROVEEDOR / PRODUCTOS');
$this->phpexcel->getActiveSheet()->getStyle('B9')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
$this->phpexcel->getActiveSheet()->getStyle('B9')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->getStyle('B9')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('B9')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('B9')->applyFromArray($this->styles('blackStyle'));
$this->phpexcel->getActiveSheet()->getStyle('C9:F9')->getAlignment()->setWrapText(true);
$this->phpexcel->getActiveSheet()->setCellValue('C9', 'U.M.');
$this->phpexcel->getActiveSheet()->getStyle('C9')->getFont()->setSize(12);
$this->phpexcel->getActiveSheet()->getStyle('C9')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->phpexcel->getActiveSheet()->getStyle('C9')->getFont()->setName('Arial');
$this->phpexcel->getActiveSheet()->getStyle('C9')->getFont()->setItalic(true);
$this->phpexcel->getActiveSheet()->getStyle('C9')->applyFromArray($this->styles('blackStyle'));
$this->phpexcel->getActiveSheet()->setCellValue('D9', 'Saldo inicial');
//.........这里部分代码省略.........
示例11: array
$dis = $c->distrito;
break;
}
$titulo = "INFORME MENSUAL";
$subtitulo = $etiqueta . ":" . $nombre;
$ubicacion = "Iglesia: " . $igle . " Dto." . $dis;
// $church = "Iglesia: ".$igle;
// $distrito = "Distrito: ".$dis;
$fecha = "MES DE MARZO 2014";
$estilo = array('borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THICK, 'color' => array('argb' => '000000'))));
$excel->getActiveSheet()->getStyle('B6:I6')->applyFromArray($estilo);
$logotipo = new PHPExcel_Worksheet_Drawing();
$logotipo->setName('Logo');
$logotipo->setDescription('Logo');
$logotipo->setOffsetX(10);
$logotipo->setRotation(45);
$logotipo->setPath('./images/icon.png');
$logotipo->setHeight(36);
$excel->getActiveSheet()->getStyle('A1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_RED);
/*$excel->setActiveSheetIndex(0)->mergeCells('C1:F1');
$excel->setActiveSheetIndex(0)->mergeCells('C2:F2');
$excel->setActiveSheetIndex(0)->mergeCells('C3:D3');
$excel->setActiveSheetIndex(0)->mergeCells('E3:F3');
$excel->setActiveSheetIndex(0)->mergeCells('C4:F4');*/
$excel->getActiveSheet()->mergeCells('C1:D1');
$excel->getActiveSheet()->mergeCells('C2:E2');
$excel->getActiveSheet()->mergeCells('C3:H3');
$excel->getActiveSheet()->mergeCells('C4:D4');
$excel->getActiveSheet()->setCellValue('C1', $titulo);
$excel->getActiveSheet()->setCellValue('C2', $subtitulo);
$excel->getActiveSheet()->setCellValue('C3', $ubicacion);