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


PHP PHPExcel_Worksheet_Drawing::getShadow方法代码示例

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


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

示例1: 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"]);
												}
											}
										}
										$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")));

													if ($xfrm) {
														$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
开发者ID:Opmantek,项目名称:open-audit,代码行数:67,代码来源:Excel2007.php

示例2: ponerLogo

 public static function ponerLogo($objActSheet, $coordinate)
 {
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('IntegrarCT');
     $objDrawing->setDescription('Logo IntegrarCT');
     $objDrawing->setPath($_SERVER['DOCUMENT_ROOT'] . '/integrarCT/resources/img/logo_reporte.png');
     $objDrawing->setHeight(70);
     $objDrawing->setCoordinates($coordinate);
     //$objDrawing->setOffsetX(10);
     //$objDrawing->setRotation(15);
     $objDrawing->getShadow()->setVisible(true);
     $objDrawing->getShadow()->setDirection(70);
     $objDrawing->setWorksheet($objActSheet);
 }
开发者ID:haescall,项目名称:integrarCT,代码行数:14,代码来源:UtilExcelPHP.php

示例3: load


//.........这里部分代码省略.........
                                     $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);
                                                 $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex((string) $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));
开发者ID:jimlongo56,项目名称:bhouse,代码行数:67,代码来源:Excel2007.php

示例4: date

$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;
$objPHPExcel->getActiveSheet()->insertNewRowBefore(6, 10);
开发者ID:benleibert,项目名称:channel-software,代码行数:31,代码来源:05featuredemo.inc.php

示例5: 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;
 }
开发者ID:735579768,项目名称:Ainiku,代码行数:96,代码来源:PhpexcelPlugin.class.php

示例6: write

 function write($content, $char = "A1", $ispic = false, $align = "", $isnum = false)
 {
     //如果是图片
     if ($ispic && is_file($content) && file_exists($content)) {
         $w_h = explode(":", $ispic);
         $pic_width = intval($w_h[0]) > 0 ? intval($w_h[0]) : 100;
         $pic_height = intval($w_h[1]) > 0 ? intval($w_h[1]) : 100;
         $XLS_D = new PHPExcel_Worksheet_Drawing();
         //画图片
         $XLS_D->setPath($content);
         $XLS_D->setOffsetX(6);
         $XLS_D->setOffsetY(3);
         $XLS_D->setHeight($pic_width);
         $XLS_D->setWidth($pic_height);
         $XLS_D->setCoordinates($char);
         $XLS_D->getShadow()->setVisible(true);
         $XLS_D->setWorksheet($this->phpexcel->getActiveSheet());
     } else {
         //居中和居右设置
         if ($align == "center") {
             $this->phpexcel->getActiveSheet()->getStyle($char)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
         } elseif ($align == "right") {
             $this->phpexcel->getActiveSheet()->getStyle($char)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
         }
         //垂直居中
         $this->phpexcel->getActiveSheet()->getStyle($char)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
         $this->phpexcel->getActiveSheet()->getStyle($char)->getAlignment()->setWrapText(true);
         if (!$isnum) {
             $this->phpexcel->getActiveSheet()->setCellValueExplicit($char, $content, PHPExcel_Cell_DataType::TYPE_STRING);
         } else {
             $this->phpexcel->getActiveSheet()->setCellValue($char, $content);
         }
     }
 }
开发者ID:norain2050,项目名称:hkgbf,代码行数:34,代码来源:excel_out.php

示例7: 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;
     }
 }
开发者ID:silotester,项目名称:silo,代码行数:37,代码来源:Logic_Report.php

示例8: _writeDrawing


//.........这里部分代码省略.........
         $objWriter->startElement('a:srgbClr');
         $objWriter->writeAttribute('val', 'FFFFFF');
         /* SHADE
         								// a:shade
         								$objWriter->startElement('a:shade');
         								$objWriter->writeAttribute('val', '85000');
         								$objWriter->endElement();
         */
         $objWriter->endElement();
         $objWriter->endElement();
         /*
         						// a:ln
         						$objWriter->startElement('a:ln');
         						$objWriter->writeAttribute('w', '88900');
         						$objWriter->writeAttribute('cap', 'sq');
         
         							// a:solidFill
         							$objWriter->startElement('a:solidFill');
         
         								// a:srgbClr
         								$objWriter->startElement('a:srgbClr');
         								$objWriter->writeAttribute('val', 'FFFFFF');
         								$objWriter->endElement();
         
         							$objWriter->endElement();
         
         							// a:miter
         							$objWriter->startElement('a:miter');
         							$objWriter->writeAttribute('lim', '800000');
         							$objWriter->endElement();
         
         						$objWriter->endElement();
         */
         if ($pDrawing->getShadow()->getVisible()) {
             // a:effectLst
             $objWriter->startElement('a:effectLst');
             // a:outerShdw
             $objWriter->startElement('a:outerShdw');
             $objWriter->writeAttribute('blurRad', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getBlurRadius()));
             $objWriter->writeAttribute('dist', PHPExcel_Shared_Drawing::pixelsToEMU($pDrawing->getShadow()->getDistance()));
             $objWriter->writeAttribute('dir', PHPExcel_Shared_Drawing::degreesToAngle($pDrawing->getShadow()->getDirection()));
             $objWriter->writeAttribute('algn', $pDrawing->getShadow()->getAlignment());
             $objWriter->writeAttribute('rotWithShape', '0');
             // a:srgbClr
             $objWriter->startElement('a:srgbClr');
             $objWriter->writeAttribute('val', $pDrawing->getShadow()->getColor()->getRGB());
             // a:alpha
             $objWriter->startElement('a:alpha');
             $objWriter->writeAttribute('val', $pDrawing->getShadow()->getAlpha() * 1000);
             $objWriter->endElement();
             $objWriter->endElement();
             $objWriter->endElement();
             $objWriter->endElement();
         }
         /*
         
         						// a:scene3d
         						$objWriter->startElement('a:scene3d');
         
         							// a:camera
         							$objWriter->startElement('a:camera');
         							$objWriter->writeAttribute('prst', 'orthographicFront');
         							$objWriter->endElement();
         
         							// a:lightRig
         							$objWriter->startElement('a:lightRig');
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:67,代码来源:Drawing.php

示例9: test

 public function test()
 {
     // 		ini_set("memory_limit","1024M");
     // 		$html = file_get_contents('../'.EXPORT_TEMP_PATH.'13554680705609.html');;
     // 		require_once dirname(__FILE__)."/../Util/MPDF54/mpdf.php";
     // 		$mpdf=new mPDF();
     // 		$mpdf->useAdobeCJK = true;		// Default setting in config.php
     // 		// You can set this to false if you have defined other CJK fonts
     // 		$mpdf->SetAutoFont(AUTOFONT_CJK);	//	AUTOFONT_CJK | AUTOFONT_THAIVIET | AUTOFONT_RTL | AUTOFONT_INDIC	// AUTOFONT_ALL
     // 		// () = default ALL, 0 turns OFF (default initially)
     // 		$mpdf->WriteHTML($html);
     // 		$filename = '../'.EXPORT_TEMP_PATH.'13554680705609'.'_'.rand(100,999).'.pdf';
     // 		$mpdf->Output($filename);
     // 		echo $filename;
     // 		Log::write(date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB" );
     // 		$objReader = PHPExcel_IOFactory::createReader('Excel5');
     // 		$objPHPExcel = $objReader->load(EXCEL_TEMPLATES_PATH."track_template.xls");
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $objPHPExcel = $objReader->load(EXCEL_TEMPLATES_PATH . "track_template.xlsx");
     $row = 9;
     $objPHPExcel->getActiveSheet()->setCellValue('A' . $row, date('Y-m-d H:i:s'))->setCellValue('B' . $row, '内蒙古自治区包头市东河区,西脑包南五道巷-巴彦塔拉西大街交叉路口,包头市东河区国家税务局,中国石油宁鹿大酒店,出租车上下客站附近')->setCellValue('C' . $row, 25.33)->setCellValue('D' . $row, '东北')->setCellValue('E' . $row, '正常');
     $objPHPExcel->getActiveSheet()->getRowDimension($row)->setRowHeight(-1);
     // 		$ws  = "\nwidth A:" . $objPHPExcel->getActiveSheet()->getColumnDimension('A')->getWidth();
     // 		$ws .= "\nwidth B:" . $objPHPExcel->getActiveSheet()->getColumnDimension('B')->getWidth();
     // 		$ws .= "\nwidth C:" . $objPHPExcel->getActiveSheet()->getColumnDimension('C')->getWidth();
     // 		$ws .= "\nwidth D:" . $objPHPExcel->getActiveSheet()->getColumnDimension('D')->getWidth();
     // 		$ws .= "\nwidth E:" . $objPHPExcel->getActiveSheet()->getColumnDimension('E')->getWidth();
     // 		Log::write($ws);
     $widthPT = ($objPHPExcel->getActiveSheet()->getColumnDimension('A')->getWidth() + $objPHPExcel->getActiveSheet()->getColumnDimension('B')->getWidth() + $objPHPExcel->getActiveSheet()->getColumnDimension('C')->getWidth() + $objPHPExcel->getActiveSheet()->getColumnDimension('D')->getWidth() + $objPHPExcel->getActiveSheet()->getColumnDimension('E')->getWidth()) * 6;
     //经验:导出成Excel2007
     // 				* 4.7499; //经验:导出成PDF
     Log::write("\n-----------widthPT:" . $widthPT . "-----------");
     $widthPX = round($widthPT * 4 / 3);
     Log::write("\n-----------widthPX:" . $widthPX . "-----------");
     $heightPT = 300;
     $heightPX = 400;
     $objPHPExcel->getActiveSheet()->getRowDimension('6')->setRowHeight($heightPT);
     $rendererName = PHPExcel_Settings::PDF_RENDERER_MPDF;
     $rendererLibrary = 'mPDF5.4';
     $rendererLibraryPath = dirname(__FILE__) . '/../Util/MPDF54';
     PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath);
     // 		$widthPX +=-2;	//Excel5和Excel2007才需要
     // 		$heightPX +=-2;
     $url = 'http://api.map.baidu.com/staticimage?width=' . $widthPX . '&height=' . $heightPX . '&center=116.468265,39.90692&zoom=11&markers=116.418822,39.859083|116.49586,39.960917&markerStyles=l,|l,';
     $newfname = '../' . EXPORT_TEMP_PATH . 'staticimage.png';
     $file = fopen($url, "rb");
     if ($file) {
         $newf = fopen($newfname, "wb");
         if ($newf) {
             while (!feof($file)) {
                 fwrite($newf, fread($file, 1024 * 8), 1024 * 8);
             }
         }
     }
     if ($file) {
         fclose($file);
     }
     if ($newf) {
         fclose($newf);
     }
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('map');
     $objDrawing->setDescription('Map');
     $objDrawing->setPath('../' . EXPORT_TEMP_PATH . 'staticimage.png');
     // 		$objDrawing->setOffsetX(1);	//Excel5和Excel2007才需要
     // 		$objDrawing->setOffsetY(1);
     // 		$objDrawing->setHeight($heightPT);
     $objDrawing->setCoordinates('A6');
     $objDrawing->getShadow()->setVisible(true);
     $objDrawing->getShadow()->setDirection(45);
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $wd = "\nWidth: " . $objDrawing->getWidth();
     $wd .= "\nHeight: " . $objDrawing->getHeight();
     Log::write($wd);
     $file = EXPORT_TEMP_PATH . time() . rand(1000, 9999) . '.pdf';
     $objPHPExcel->getActiveSheet()->setShowGridlines(false);
     //要导出成PDF(或者HTML)这个比较重要,否则表格线会造成出来的结果不好
     ini_set("memory_limit", "1024M");
     //MPDF消耗内存比较厉害
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
     $objWriter->setImagesRoot('..');
     $objWriter->setPrintParams('A4', 'P', '', '', '', '', 16, 16, 15, 15, 9, 9, true, null, null);
     $objWriter->save('../' . $file);
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'HTML');
     $objWriter->save('../' . str_replace('.pdf', '.html', $file));
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('../' . str_replace('.pdf', '.xls', $file));
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('../' . str_replace('.pdf', '.xlsx', $file));
 }
开发者ID:jumboluo,项目名称:tracking,代码行数:90,代码来源:LogAction.class.php

示例10: load


//.........这里部分代码省略.........
                             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) {
                                                 $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
                                             }
                                             if ($outerShdw) {
开发者ID:abhinay100,项目名称:fengoffice_app,代码行数:67,代码来源:Excel2007.php

示例11: 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
//.........这里部分代码省略.........
开发者ID:phoenixwubo,项目名称:SIS,代码行数:101,代码来源:StudentsController.php

示例12: stripslashes

$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);
$objPHPExcel->getActiveSheet()->getStyle("A{$cell_row}:E{$cell_row}")->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
//PO Title
$cell_row += 1;
开发者ID:akosiempre,项目名称:purchase_monitor,代码行数:31,代码来源:print_purchaseorder.php

示例13: _exportData2Excel

 private function _exportData2Excel($target = 'Excel2007')
 {
     require_once dirname(__FILE__) . "/../Util/PHPExcel/PHPExcel/IOFactory.php";
     $session_id = $this->_request('session_id');
     $filename = $this->_request('file');
     $device_id = $this->_request('device') + 0;
     if (empty($session_id) || empty($filename) || empty($device_id)) {
         return;
     }
     session_id($session_id);
     session_write_close();
     ignore_user_abort(true);
     set_time_limit(0);
     R('File/setfilepercent', array($filename, '正在读取模版文件...'));
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $objPHPExcel = $objReader->load(EXCEL_TEMPLATES_PATH . "track_template.xlsx");
     $activeSheet = $objPHPExcel->getActiveSheet();
     $condition = $this->_parseCondition();
     //先查一下Device信息,以便在没有定位数据的情况下仍然能填写表头数据
     $Device = M('Device');
     check_error($Device);
     R('File/setfilepercent', array($filename, '正在查询设备信息...'));
     $device = $Device->join('`department` on `department`.`id`=`device`.`department_id`')->field(array('`target_type`', '`target_name`', '`department`.`name`' => 'department_name'))->where("`device`.`id`={$device_id}")->find();
     check_error($Device);
     if (empty($device)) {
         R('File/fileexit', array($filename, '设备id错误:无法查找到指定id的设备'));
     }
     R('File/setfilepercent', array($filename, '正在处理表头信息...'));
     //写表头信息:
     $activeSheet->setCellValue('A1', $device['target_type'] . '轨迹数据')->setCellValue('A2', '定位对象:' . $device['target_name'])->setCellValue('A3', '所属分组:' . $device['department_name'])->setCellValue('C2', '从:' . $_REQUEST['startTime']);
     if (!empty($_REQUEST['endTime'])) {
         $activeSheet->setCellValue('C3', '到:' . $_REQUEST['endTime']);
     }
     $Location = M('Location');
     check_error($Location);
     R('File/setfilepercent', array($filename, '正在查询数据库...'));
     $locations = $Location->join('`device` on `device`.`id`=`location`.`device_id`')->join('`department` on `department`.`id`=`device`.`department_id`')->field(array('`location`.`id`', '`device`.`department_id`', '`department`.`name`' => 'department', '`location`.`device_id`', '`device`.`type`', '`device`.`label`', '`device`.`target_type`', '`device`.`target_id`', '`device`.`target_name`', '`location`.`time`', 'state', 'online', '`location`.`address`', 'baidu_lat', 'baidu_lng', 'speed', 'direction', 'mcc', 'mnc', 'lac', 'cellid', '`location`.`range`'))->where($condition)->order('`time` ASC')->select();
     check_error($Location);
     if (empty($locations)) {
         $activeSheet->setCellValue('A6', '没有定位数据');
     } else {
         $center = $this->_request('center');
         $width = $this->_request('width') + 0;
         $height = $this->_request('height') + 0;
         $zoom = $this->_request('zoom') + 0;
         if (empty($center) || empty($width) || empty($height) || empty($zoom)) {
             $activeSheet->setCellValue('A6', '地图参数不正确,无法创建地图');
         } else {
             $mapparams = array('center' => $center, 'width' => $width, 'height' => $height, 'zoom' => $zoom);
         }
     }
     $total = count($locations);
     R('File/setfilepercent', array($filename, '正在处理数据库查询结果...', $total, 0));
     $lastTime = time();
     $baseRow = 9;
     $startMarker = null;
     $endMarker = null;
     $paths = array();
     foreach ($locations as $r => $dataRow) {
         $row = $baseRow + $r;
         if ($r) {
             $activeSheet->insertNewRowBefore($row, 1);
         }
         if (!empty($dataRow['baidu_lat']) && !empty($dataRow['baidu_lng'])) {
             $endMarker = $p = $dataRow['baidu_lng'] . "," . $dataRow['baidu_lat'];
             if (empty($startMarker)) {
                 $startMarker = $p;
             }
             $paths[] = $p;
         }
         $activeSheet->setCellValue('A' . $row, $dataRow['time'])->setCellValue('B' . $row, $dataRow['address'])->setCellValue('C' . $row, $dataRow['speed'])->setCellValue('D' . $row, $dataRow['direction'])->setCellValue('E' . $row, $dataRow['state']);
         $activeSheet->getRowDimension($row)->setRowHeight(-1);
         if (time() - $lastTime) {
             //过了1秒
             $lastTime = time();
             R('File/setfilepercent', array($filename, '正在处理数据库查询结果...', $total, $r + 1));
         }
     }
     if (!empty($mapparams)) {
         R('File/setfilepercent', array($filename, '正在准备地图...'));
         if (!empty($startMarker)) {
             $mapparams['markers'] = $startMarker;
             $mapparams['markerStyles'] = 'm,A';
         }
         if (!empty($endMarker) && !empty($mapparams['markers'])) {
             $mapparams['markers'] .= '|' . $endMarker;
             $mapparams['markerStyles'] = '|m,B';
         }
         if (!empty($paths)) {
             $mapparams['paths'] = implode(";", $paths);
             $mapparams['pathStyles'] = '0xff0000,3,1';
         }
         $img = R('File/getbaidumapstaticimage', array($mapparams));
         if ($img) {
             $objDrawing = new PHPExcel_Worksheet_Drawing();
             $objDrawing->setName('map');
             $objDrawing->setDescription('Map');
             $objDrawing->setPath($img);
             $objDrawing->setCoordinates('A6');
             $objDrawing->getShadow()->setVisible(true);
//.........这里部分代码省略.........
开发者ID:jumboluo,项目名称:tracking,代码行数:101,代码来源:TrackingAction.class.php

示例14: 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;
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:101,代码来源:Excel2007.php

示例15: 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');
//.........这里部分代码省略.........
开发者ID:norbyn,项目名称:alimentos,代码行数:101,代码来源:reportes.php


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