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


PHP PHPExcel_Worksheet_Drawing::setWorksheet方法代码示例

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


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

示例1: ExportExcelRecord

function ExportExcelRecord($arrdata, $datatype, $numberRow, $objPHPExcel, $pageObj)
{
    global $cCharset, $locale_info;
    $col = -1;
    $objASIndex = $objPHPExcel->setActiveSheetIndex(0);
    $objASheet = $objPHPExcel->getActiveSheet();
    $rowDim = $objASIndex->getRowDimension($numberRow + 1);
    foreach ($arrdata as $field => $data) {
        $col++;
        $colLetter = PHPExcel_Cell::stringFromColumnIndex($col);
        $colDim = $objASIndex->getColumnDimension($colLetter);
        if ($datatype[$field] == "binary") {
            if (!$data) {
                continue;
            }
            if (!function_exists("imagecreatefromstring")) {
                $objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, "LONG BINARY DATA - CANNOT BE DISPLAYED");
                continue;
            }
            $error_handler = set_error_handler("empty_error_handler");
            $gdImage = imagecreatefromstring($data);
            if ($error_handler) {
                set_error_handler($error_handler);
            }
            if ($gdImage) {
                $objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
                $objDrawing->setImageResource($gdImage);
                $objDrawing->setCoordinates($colLetter . ($row + 1));
                $objDrawing->setWorksheet($objASheet);
                $width = $objDrawing->getWidth() * 0.143;
                $height = $objDrawing->getHeight() * 0.75;
                if ($rowDim->getRowHeight() < $height) {
                    $rowDim->setRowHeight($height);
                }
                $colDimSh = $objASheet->getColumnDimension($colLetter);
                $colDimSh->setAutoSize(false);
                if ($colDim->getWidth() < $width) {
                    $colDim->setWidth($width);
                }
            }
        } elseif ($datatype[$field] == "file") {
            $arr = my_json_decode($row[$field]);
            if (count($arr) == 0) {
                $data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
                if ($data == "<img src=\"images/no_image.gif\" />") {
                    $arr[] = array("name" => "images/no_image.gif");
                } else {
                    if (substr($data, 0, 1) == '=') {
                        $data = '="' . str_replace('"', '""', $data) . '"';
                    }
                    $objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
                    continue;
                }
            }
            $offsetY = 0;
            $height = 0;
            foreach ($arr as $img) {
                if (!file_exists($img["name"]) || !$img["name"]) {
                    $data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
                    if (substr($data, 0, 1) == '=') {
                        $data = '="' . str_replace('"', '""', $data) . '"';
                    }
                    $objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
                    continue;
                }
                $objDrawing = new PHPExcel_Worksheet_Drawing();
                $objDrawing->setPath($img["name"]);
                $objDrawing->setCoordinates($colLetter . ($numberRow + 1));
                $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
                $objDrawing->setOffsetY($offsetY);
                $width = $objDrawing->getWidth() * 0.143;
                $height = $height + $objDrawing->getHeight() * 0.75;
                $offsetY = $offsetY + $objDrawing->getHeight();
                if ($rowDim->getRowHeight() < $height) {
                    $rowDim->setRowHeight($height);
                }
                $colDimSh = $objASheet->getColumnDimension($colLetter);
                $colDimSh->setAutoSize(false);
                if ($colDim->getWidth() < $width) {
                    $colDim->setWidth($width);
                }
            }
        } else {
            $data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
            if (substr($data, 0, 1) == '=') {
                $data = '="' . str_replace('"', '""', $data) . '"';
            }
            $objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
            if ($datatype[$field] == "date") {
                $objStyle = $objASIndex->getStyle($colLetter . ($numberRow + 1));
                $objNumFrm = $objStyle->getNumberFormat();
                $objNumFrm->setFormatCode($locale_info["LOCALE_SSHORTDATE"] . " hh:mm:ss");
            }
        }
    }
}
开发者ID:ryanblanchard,项目名称:Dashboard,代码行数:96,代码来源:export_functions_excel.php

示例2: load


//.........这里部分代码省略.........
											}
										}
										$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")));
													}
													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"));
开发者ID:Opmantek,项目名称:open-audit,代码行数:67,代码来源:Excel2007.php

示例3: hacerReporte

 public function hacerReporte()
 {
     error_reporting(E_ALL);
     ini_set('display_errors', TRUE);
     ini_set('display_startup_errors', TRUE);
     date_default_timezone_set('Europe/London');
     if (PHP_SAPI == 'cli') {
         die('This example should only be run from a Web Browser');
     }
     // Create new PHPExcel object
     $objPHPExcel = new PHPExcel();
     // Set document properties
     $objPHPExcel->getProperties()->setCreator("Inmobiliaria Castilla")->setLastModifiedBy("Inmobiliaria Castilla")->setTitle("Apartados")->setSubject("Apartados ")->setDescription("Apartados ")->setKeywords("office 2007 openxml php")->setCategory("Apartados ");
     $objPHPExcel->getActiveSheet()->setTitle('Apartados');
     //Imagen
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('imagenCastilla');
     $objDrawing->setDescription('Imagen de inmobiliaria Castilla');
     $objDrawing->setPath('img/logo.jpg');
     $objDrawing->setHeight(35);
     $objDrawing->setCoordinates('B2');
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $objPHPExcel->setActiveSheetIndex()->mergeCells('F2:O2');
     for ($columna = 'B'; $columna <= 'O'; $columna++) {
         $objPHPExcel->getActiveSheet()->getColumnDimension($columna)->setAutoSize(true);
     }
     $objPHPExcel->getActiveSheet()->setCellValue('F2', 'Apartados')->setCellValue('N3', 'Fecha de reporte')->setCellValue('O3', date('Y-m-d'));
     $objPHPExcel->getActiveSheet()->getStyle('F2:O2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->setCellValue('B6', 'Expediente')->setCellValue('C6', 'Lote')->setCellValue('D6', 'Manzana')->setCellValue('E6', 'Desarrollo')->setCellValue('F6', 'Cliente')->setCellValue('G6', 'Fecha')->setCellValue('H6', 'Enganche estimado')->setCellValue('I6', 'Porcentaje de enganche')->setCellValue('J6', 'Descuento estimado')->setCellValue('K6', 'Porcentaje de descuento')->setCellValue('L6', 'Saldo estimado')->setCellValue('M6', 'Forma de pago')->setCellValue('N6', 'Compromiso de apartado')->setCellValue('O6', 'Monto del apartado')->setCellValue('P6', 'Observaciones');
     $renglon = 7;
     for ($apartado = 0; $apartado < count($this->apartados); $apartado++) {
         if ($this->apartados[$apartado]->tipo == 1) {
             $cliente = $this->apartados[$apartado]->nombre . " " . $this->apartados[$apartado]->ape_pate . " " . $this->apartados[$apartado]->ape_mate;
         } else {
             $cliente = $this->apartados[$apartado]->denominacion;
         }
         $objPHPExcel->getActiveSheet()->setCellValue('B' . $renglon, $this->apartados[$apartado]->id_expediente)->setCellValue('C' . $renglon, $this->apartados[$apartado]->lote)->setCellValue('D' . $renglon, $this->apartados[$apartado]->num_letra)->setCellValue('E' . $renglon, $this->apartados[$apartado]->nombre)->setCellValue('F' . $renglon, $cliente)->setCellValue('G' . $renglon, $this->apartados[$apartado]->fecha)->setCellValue('H' . $renglon, $this->apartados[$apartado]->enganche_estimado)->setCellValue('I' . $renglon, $this->apartados[$apartado]->porEnganche)->setCellValue('J' . $renglon, $this->apartados[$apartado]->descuentoEstimado)->setCellValue('K' . $renglon, $this->apartados[$apartado]->porDescuento)->setCellValue('L' . $renglon, $this->apartados[$apartado]->saldo_estimado)->setCellValue('M' . $renglon, $this->apartados[$apartado]->forma_pago)->setCellValue('N' . $renglon, $this->apartados[$apartado]->monto_apartado)->setCellValue('O' . $renglon, 0)->setCellValue('P' . $renglon, $this->apartados[$apartado]->observaciones);
         $renglon++;
     }
     // Redirect output to a client’s web browser (Excel5)
     header('Content-Type: application/vnd.ms-excel');
     $hoy = date("m_d_Y");
     header('Content-Disposition: attachment; filename="' . $hoy . $cliente . 'apartados.xls"');
     header('Cache-Control: max-age=0');
     // If you're serving to IE 9, then the following may be needed
     header('Cache-Control: max-age=1');
     // If you're serving to IE over SSL, then the following may be needed
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     // always modified
     header('Cache-Control: cache, must-revalidate');
     // HTTP/1.1
     header('Pragma: public');
     // HTTP/1.0
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:vipomx,项目名称:Castilla,代码行数:59,代码来源:reporteApartados.php

示例4: hacerReporte

 public function hacerReporte()
 {
     error_reporting(E_ALL);
     ini_set('display_errors', TRUE);
     ini_set('display_startup_errors', TRUE);
     date_default_timezone_set('Europe/London');
     if (PHP_SAPI == 'cli') {
         die('This example should only be run from a Web Browser');
     }
     // Create new PHPExcel object
     $objPHPExcel = new PHPExcel();
     // Set document properties
     $objPHPExcel->getProperties()->setCreator("Inmobiliaria Castilla")->setLastModifiedBy("Inmobiliaria Castilla")->setTitle("Catalogo de Clientes Principales")->setSubject("Catalogo de Clientes Principales")->setDescription("Catalogo de Clientes Principales")->setKeywords("office 2007 openxml php")->setCategory("Catalogo de Clientes Principales");
     $objPHPExcel->getActiveSheet()->setTitle('Clientes');
     //Imagen
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('imagenCastilla');
     $objDrawing->setDescription('Imagen de inmobiliaria Castilla');
     $objDrawing->setPath('img/logo.jpg');
     $objDrawing->setHeight(35);
     $objDrawing->setCoordinates('B2');
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $objPHPExcel->setActiveSheetIndex()->mergeCells('F2:O2');
     for ($columna = 'B'; $columna <= 'O'; $columna++) {
         $objPHPExcel->getActiveSheet()->getColumnDimension($columna)->setAutoSize(true);
     }
     $objPHPExcel->getActiveSheet()->setCellValue('F2', 'Catalogo de Clientes Principales Inmobiliaria Castilla');
     $objPHPExcel->getActiveSheet()->getStyle('F2:O2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->setCellValue('F4', 'Fecha del reporte')->setCellValue('G4', date('Y-m-d'))->setCellValue('B6', 'RFC')->setCellValue('C6', 'Denominación')->setCellValue('D6', 'Nombre')->setCellValue('E6', 'Apellido paterno')->setCellValue('F6', 'Apellido materno')->setCellValue('G6', 'Telefono oficina')->setCellValue('H6', 'Email')->setCellValue('I6', 'Contratos activos');
     $renglon = 7;
     for ($cliente = 0; $cliente < count($this->catalogoCliente); $cliente++) {
         $objPHPExcel->getActiveSheet()->setCellValue('A' . $renglon, $cliente + 1)->setCellValue('B' . $renglon, $this->catalogoCliente[$cliente]['cliente']->rfc)->setCellValue('C' . $renglon, $this->catalogoCliente[$cliente]['cliente']->denominacion)->setCellValue('D' . $renglon, $this->catalogoCliente[$cliente]['cliente']->nombre)->setCellValue('E' . $renglon, $this->catalogoCliente[$cliente]['cliente']->ape_pate)->setCellValue('F' . $renglon, $this->catalogoCliente[$cliente]['cliente']->ape_mate)->setCellValue('G' . $renglon, $this->catalogoCliente[$cliente]['cliente']->telefono)->setCellValue('H' . $renglon, $this->catalogoCliente[$cliente]['cliente']->email)->setCellValue('I' . $renglon, $this->catalogoCliente[$cliente]['numero_expedientes']);
         $columna = "J";
         for ($contrato = 0; $contrato < count($this->catalogoCliente[$cliente]['expedientes']); $contrato++) {
             $objPHPExcel->getActiveSheet()->setCellValue($columna . $renglon, $this->catalogoCliente[$cliente]['expedientes'][$contrato]->id_expediente);
             $columna++;
         }
         $renglon++;
     }
     // Redirect output to a client’s web browser (Excel5)
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;corrida_financiera.xls"');
     header('Cache-Control: max-age=0');
     // If you're serving to IE 9, then the following may be needed
     header('Cache-Control: max-age=1');
     // If you're serving to IE over SSL, then the following may be needed
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     // always modified
     header('Cache-Control: cache, must-revalidate');
     // HTTP/1.1
     header('Pragma: public');
     // HTTP/1.0
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:vipomx,项目名称:Castilla,代码行数:58,代码来源:reporteClientesPrincipales.php

示例5: attachChart

 private function attachChart($img_path)
 {
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName($this->title);
     $objDrawing->setDescription($this->title . ' graph');
     $objDrawing->setPath($img_path);
     $objDrawing->setCoordinates($this->cell);
     $objDrawing->setWorksheet($this->worksheet);
     $getRow = str_replace($this->cell[0], "", $this->cell);
     $this->worksheet->getRowDimension($getRow)->setRowHeight($this->height);
 }
开发者ID:chriistiian,项目名称:phpexcel-adodb-report-generator,代码行数:11,代码来源:Charting.class.php

示例6: addImage

function addImage($range, $excelAPI, $imageName, $merged, $excelWorksheet)
{
    $objDrawing = new PHPExcel_Worksheet_Drawing();
    $objDrawing->setName('DOTC LOGO');
    $objDrawing->setDescription('Dotc Logo');
    $objDrawing->setPath($imageName);
    //$objDrawing->setHeight(36);
    $objDrawing->setWorksheet($excelAPI->getActiveSheet());
    $objDrawing->setCoordinates(strtoupper($range[0]));
    //	setImagesRoot('http://www.example.com');
    //	$excelAPI->insertImage($imageName,$range[0],$range[1],$merged,$excelWorksheet);
}
开发者ID:vik0803,项目名称:bootstrapped_helpdesk,代码行数:12,代码来源:excel+functions.php

示例7: addImageFooter

function addImageFooter($objPHPExcel, $index)
{
    $objDrawing = new PHPExcel_Worksheet_Drawing();
    $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
    $objDrawing->setName("name");
    $objDrawing->setDescription("Description");
    $objDrawing->setPath('../img/LogoBSW.png');
    $objDrawing->setCoordinates("A" . $index);
    $objDrawing->setOffsetX(10);
    $objDrawing->setWidth(20);
    $objDrawing->setHeight(20);
}
开发者ID:rafaelurrutia,项目名称:techwizard-nodejs,代码行数:12,代码来源:htmlTableGenerateExcelFile.php

示例8: 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

示例9: _excel_add_image

 private function _excel_add_image($sheet, $image, &$i)
 {
     if (!(string) $image) {
         return --$i ? '' : '';
     }
     download_web_file($image->url('350x230p'), $filepath = FCPATH . implode(DIRECTORY_SEPARATOR, array_merge(Cfg::system('orm_uploader', 'uploader', 'temp_directory'), array((string) $image))));
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setPath($filepath);
     $j = $j = (ceil($i / 3) - 1) * 7 + 1;
     $objDrawing->setCoordinates(($i % 3 < 2 ? $i % 3 < 1 ? 'G' : 'A' : 'D') . $j);
     $objDrawing->setOffsetX(20);
     $objDrawing->setOffsetY(8);
     $objDrawing->setWidth(175);
     $objDrawing->setWorksheet($sheet);
     return $filepath;
 }
开发者ID:comdan66,项目名称:zeusdesign,代码行数:16,代码来源:invoices.php

示例10: _convert_array_to_excel

 /**
  * @author caochunhui@dachuwang.com
  * @description 用数组和地址直接生成excel文件
  * 每一个数组占一个sheet
  */
 private function _convert_array_to_excel($arr = array(), $sheet_titles = array(), $out_name = '', $barcode_arr = array())
 {
     //下面的代码是抄的。
     //set cache
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
     //open excel file
     $write_objPHPExcel = new PHPExcel();
     $write_objPHPExcel->getDefaultStyle()->getFont()->setName('simsun')->setSize(10);
     //下面要循环了
     $sheet_cnt = 0;
     foreach ($arr as $item) {
         //用订单id.csv来命名每一个sheet
         $out_sheet = new PHPExcel_Worksheet($write_objPHPExcel, $sheet_titles[$sheet_cnt]);
         //$out_sheet->setTitle($item);
         //row index start from 1
         $row_index = 0;
         foreach ($item as $row) {
             $row_index++;
             //$cellIterator = $row->getCellIterator();
             //$cellIterator->setIterateOnlyExistingCells(false);
             //column index start from 0
             $column_index = -1;
             foreach ($row as $cell) {
                 $column_index++;
                 //var_dump($cell);
                 $out_sheet->setCellValueByColumnAndRow($column_index, $row_index, $cell, PHPExcel_Cell_DataType::TYPE_STRING);
             }
         }
         //如果条码数组不为空,那么说明需要在sheet里插入条码
         if (!empty($barcode_arr) && isset($barcode_arr[$sheet_cnt])) {
             $barcode_download_res = $this->_download_barcode($barcode_arr[$sheet_cnt]);
             if ($barcode_download_res['code'] == 200) {
                 //no pic you say a jb
                 $pic_path = $barcode_download_res['file'];
                 $objDrawing = new PHPExcel_Worksheet_Drawing();
                 $objDrawing->setName('barcode');
                 $objDrawing->setDescription('');
                 $objDrawing->setPath($pic_path);
                 $objDrawing->setHeight(50);
                 $objDrawing->setCoordinates('D26');
                 //$objDrawing->setOffsetX(10);
                 //$objDrawing->getShadow()->setVisible(true);
                 //$objDrawing->getShadow()->setDirection(36);
                 $objDrawing->setWorksheet($out_sheet);
                 //no pic you say a jb
             }
         }
         $write_objPHPExcel->addSheet($out_sheet);
         $sheet_cnt++;
     }
     $write_objPHPExcel->removeSheetByIndex(0);
     //删除第一个空sheet
     //上面要循环了
     //上面的代码是抄的
     //write excel file
     $objWriter = new PHPExcel_Writer_Excel2007($write_objPHPExcel);
     $dir_name = dirname($out_name);
     if (!is_dir($dir_name)) {
         $res = mkdir($dir_name, 0777, TRUE);
     }
     $objWriter->save($out_name);
 }
开发者ID:xiaoziwuzui,项目名称:gdby_github_repo,代码行数:68,代码来源:excel_export.php

示例11: create_excel


//.........这里部分代码省略.........
     $objPayable = $objRichText->createTextRun(isset($data['call_after']) ? $data['call_after'] : 'nu');
     $objPayable->getFont()->setBold(true);
     $objPayable->getFont()->setItalic(true);
     $objPayable->getFont()->setColor(new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_DARKGREEN));
     $objPHPExcel->getActiveSheet()->getCell('A3')->setValue($objRichText);
     // Merge cells
     //echo date('H:i:s') , " Merge cells" , EOL;
     $objPHPExcel->getActiveSheet()->mergeCells('A3:F10');
     // Just to test...
     // Protect cells
     //echo date('H:i:s') , " Protect cells" , EOL;
     // $objPHPExcel->getActiveSheet()->getProtection()->setSheet(true);	// Needs to be set to true in order to enable any worksheet protection!
     //$objPHPExcel->getActiveSheet()->protectCells('A3:F13', 'PHPExcel');
     // Set cell number formats
     //echo date('H:i:s') , " Set cell number formats" , EOL;
     //$objPHPExcel->getActiveSheet()->getStyle('E4:F13')->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
     // Set column widths
     //echo date('H:i:s') , " Set column widths" , EOL;
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setAutoSize(true);
     $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);
     $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(12);
     $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(12);
     // Set fonts
     //echo date('H:i:s') , " Set fonts" , EOL;
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setName('Candara');
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(20);
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
     $objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
     $objPHPExcel->getActiveSheet()->getStyle('E1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
     $objPHPExcel->getActiveSheet()->getStyle('F1')->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
     $objPHPExcel->getActiveSheet()->getStyle('E' . $total_index)->getFont()->setBold(true);
     $objPHPExcel->getActiveSheet()->getStyle('F' . $total_index)->getFont()->setBold(true);
     // Set alignments
     //echo date('H:i:s') , " Set alignments" , EOL;
     $objPHPExcel->getActiveSheet()->getStyle('F' . $total_index)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
     $objPHPExcel->getActiveSheet()->getStyle('A3')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
     $objPHPExcel->getActiveSheet()->getStyle('A3')->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
     $objPHPExcel->getActiveSheet()->getStyle('B13')->getAlignment()->setShrinkToFit(true);
     // Set thin black border outline around column
     //echo date('H:i:s') , " Set thin black border outline around column" , EOL;
     $styleThinBlackBorderOutline = array('borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THIN, 'color' => array('argb' => 'FF000000'))));
     $objPHPExcel->getActiveSheet()->getStyle('A13:F' . $end_index)->applyFromArray($styleThinBlackBorderOutline);
     // Set thick brown border outline around "Total"
     //echo date('H:i:s') , " Set thick brown border outline around Total" , EOL;
     $styleThickBrownBorderOutline = array('borders' => array('outline' => array('style' => PHPExcel_Style_Border::BORDER_THICK, 'color' => array('argb' => 'FF993300'))));
     $objPHPExcel->getActiveSheet()->getStyle('E' . $total_index . ':F' . $total_index . '')->applyFromArray($styleThickBrownBorderOutline);
     // Set fills
     //echo date('H:i:s') , " Set fills" , EOL;
     $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
     $objPHPExcel->getActiveSheet()->getStyle('A1:F1')->getFill()->getStartColor()->setARGB('FF808080');
     $objPHPExcel->getActiveSheet()->getStyle('A1')->getFill()->getStartColor()->setARGB('80FFFFFF');
     // Set style for header row using alternative method
     //echo date('H:i:s') , " Set style for header row using alternative method" , EOL;
     $objPHPExcel->getActiveSheet()->getStyle('A12:F12')->applyFromArray(array('font' => array('bold' => true), 'alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'rotation' => 90, 'startcolor' => array('argb' => 'FFA0A0A0'), 'endcolor' => array('argb' => 'FFFFFFFF'))));
     $objPHPExcel->getActiveSheet()->getStyle('A12')->applyFromArray(array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT), 'borders' => array('left' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
     $objPHPExcel->getActiveSheet()->getStyle('B12')->applyFromArray(array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT)));
     $objPHPExcel->getActiveSheet()->getStyle('F12')->applyFromArray(array('borders' => array('right' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
     // Unprotect a cell
     //echo date('H:i:s') , " Unprotect a cell" , EOL;
     $objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
     // 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('Logo');
     $objDrawing->setDescription('Logo');
     $objDrawing->setPath($_SERVER['DOCUMENT_ROOT'] . '/assets/img/images/logo.jpg');
     $objDrawing->setHeight(36);
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     // Set header and footer. When no different headers for odd/even are used, odd header is assumed.
     //echo date('H:i:s') , " Set header/footer" , EOL;
     $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader('&L&BInvoice&RPrinted on &D');
     $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddFooter('&L&B' . $objPHPExcel->getProperties()->getTitle() . '&RPage &P of &N');
     // Set page orientation and size
     //echo date('H:i:s') , " Set page orientation and size" , EOL;
     $objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_PORTRAIT);
     $objPHPExcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4);
     // Rename first worksheet
     //echo date('H:i:s') , " Rename first worksheet" , EOL;
     $objPHPExcel->getActiveSheet()->setTitle('Invoice');
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objPHPExcel->setActiveSheetIndex(0);
     /** Include PHPExcel_IOFactory */
     require_once dirname(__FILE__) . '/excel/PHPExcel/IOFactory.php';
     // Save Excel 2007 file
     //echo date('H:i:s') , " Write to Excel2007 format" , EOL;
     $callStartTime = microtime(true);
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save(str_replace('.php', '.xlsx', 'invoice.xlsx'));
     //echo date('H:i:s') , " File written to " , str_replace('.php', '.xlsx', pathinfo(__FILE__, PATHINFO_BASENAME)) , EOL;
     //echo 'Call time to write Workbook was ' , sprintf('%.4f',$callTime) , " seconds" , EOL;
     // Echo memory usage
     //echo date('H:i:s') , ' Current memory usage: ' , (memory_get_usage(true) / 1024 / 1024) , " MB" , EOL;
     // Echo done
     //echo date('H:i:s') , " Done writing files" , EOL;
     //echo 'Files have been created in ' , getcwd() , EOL;
 }
开发者ID:radumargina,项目名称:ANTCR,代码行数:101,代码来源:excel.php

示例12: orderexcel

 function orderexcel($data, $title)
 {
     $phpexcel_root = ROOT . '/extends/PHPExcel';
     include_once $phpexcel_root . '/PHPExcel.php';
     $objPHPExcel = new \PHPExcel();
     foreach ($title as $index => $string) {
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index) . '1', $string);
     }
     foreach ($data as $line => $value) {
         $objPHPExcel->getActiveSheet()->getRowDimension($line + 4)->setRowHeight(-3);
         $objPHPExcel->getActiveSheet()->getStyle('D' . ($line + 4))->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
         $objPHPExcel->getActiveSheet()->getStyle('Q' . ($line + 4))->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_NUMBER_00);
         $objPHPExcel->getActiveSheet()->getStyle('R' . ($line + 4))->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_NUMBER);
         $objPHPExcel->getActiveSheet()->getStyle('F' . ($line + 4))->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
         //$objPHPExcel->getActiveSheet()->getRowDimension($line+4)->setHeight(200);
         $index = 0;
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['orderno']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['paytype']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['paynumber']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['ordertotalamount']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['ordertaxamount']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['ordergoodsamount']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['feeamount']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['tradetime']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['totalamount']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consigneetel']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consignee']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['zipcode']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consigneeprovince']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consigneecity']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consigneecounty']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['consigneeaddress']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['postmode']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['username']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['sku']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['productname']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['unitprice']);
         $objPHPExcel->getActiveSheet()->setCellValue(chr(ord('A') + $index++) . ($line + 4), $value['num']);
         if (!empty($value['img'])) {
             $objDrawing = new \PHPExcel_Worksheet_Drawing();
             $objDrawing->setName($value['productname']);
             $objDrawing->setPath($value['img'][0]['thumbnail_path']);
             $objDrawing->setCoordinates(chr(ord('A') + $index++) . ($line + 4));
             $objDrawing->setResizeProportional(true);
             $objDrawing->setWidthAndHeight(100, 100);
             $objDrawing->setOffsetX(100);
             $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
         }
     }
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $filename = time('Y-m-d H:i:s') . '.xls';
     $objWriter->save($filename);
     return $filename;
 }
开发者ID:jin123456bat,项目名称:home,代码行数:54,代码来源:excel.php

示例13: PHPExcel


//.........这里部分代码省略.........
     $objPHPExcel->getActiveSheet()->setCellValue('A1', '图片');
     $objPHPExcel->getActiveSheet()->setCellValue('B1', '商品编号');
     $objPHPExcel->getActiveSheet()->setCellValue('C1', '商品条形码');
     $objPHPExcel->getActiveSheet()->setCellValue('D1', '商品名称');
     $objPHPExcel->getActiveSheet()->setCellValue('E1', '商品分类');
     $objPHPExcel->getActiveSheet()->setCellValue('F1', '商品品牌');
     $objPHPExcel->getActiveSheet()->setCellValue('G1', '商品规格');
     $objPHPExcel->getActiveSheet()->setCellValue('H1', '商品重量');
     $objPHPExcel->getActiveSheet()->setCellValue('I1', '产地');
     $objPHPExcel->getActiveSheet()->setCellValue('J1', '生产商');
     $objPHPExcel->getActiveSheet()->setCellValue('K1', '保质期');
     $objPHPExcel->getActiveSheet()->setCellValue('L1', '商品单位');
     $objPHPExcel->getActiveSheet()->setCellValue('M1', '供应价');
     $objPHPExcel->getActiveSheet()->setCellValue('N1', '批发价');
     $objPHPExcel->getActiveSheet()->setCellValue('O1', '零售价');
     $objPHPExcel->getActiveSheet()->setCellValue('P1', '商品库存');
     $objPHPExcel->getActiveSheet()->setCellValue('Q1', '库存警告数量');
     $objPHPExcel->getActiveSheet()->setCellValue('R1', 'meta关键字');
     $objPHPExcel->getActiveSheet()->setCellValue('S1', 'meta描述');
     $objPHPExcel->getActiveSheet()->setCellValue('T1', '商品赠送');
     $objPHPExcel->getActiveSheet()->setCellValue('U1', '供应商帐号');
     $objPHPExcel->getActiveSheet()->setCellValue('V1', '商品图片路径');
     $objPHPExcel->getActiveSheet()->setCellValue('W1', '商品相册[多个用|分隔]');
     //循环
     $k = 1;
     if (!empty($rt)) {
         foreach ($rt as $row) {
             ++$k;
             //居中
             /*				  $objPHPExcel->getActiveSheet()->getStyle('A'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  $objPHPExcel->getActiveSheet()->getStyle('B'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  $objPHPExcel->getActiveSheet()->getStyle('C'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				 // $objPHPExcel->getActiveSheet()->getStyle('D'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  $objPHPExcel->getActiveSheet()->getStyle('E'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  $objPHPExcel->getActiveSheet()->getStyle('F'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  $objPHPExcel->getActiveSheet()->getStyle('G'.$k)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
             				  
             				//垂直居中
             				$objPHPExcel->getActiveSheet()->getStyle('A'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('B'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('C'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('D'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('E'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('F'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
             				$objPHPExcel->getActiveSheet()->getStyle('G'.$k)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);*/
             // 设置行的高度
             $objPHPExcel->getActiveSheet()->getRowDimension($k)->setRowHeight(50);
             //赋值
             // $objPHPExcel->getActiveSheet()->getStyle('A'.$k)->applyFromArray($styleArray1);
             //$objPHPExcel->getActiveSheet()->setCellValue('B'.$k, '图片');
             // 给单元格中放入图片, 将数据图片放在J1单元格内
             $objDrawing = new PHPExcel_Worksheet_Drawing();
             $objDrawing->setName('Logo');
             $objDrawing->setDescription('Logo');
             $objDrawing->setPath(!empty($row['goods_thumb']) && file_exists(SYS_PATH . $row['goods_thumb']) ? '../' . $row['goods_thumb'] : './images/no_picture.gif');
             // 图片路径,只能是相对路径
             //$objDrawing->setWidth(60); // 图片宽度
             $objDrawing->setHeight(50);
             // 图片高度
             $objDrawing->setCoordinates('A' . $k);
             $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
             $objPHPExcel->getActiveSheet()->setCellValue('B' . $k, $row['goods_bianhao']);
             $objPHPExcel->getActiveSheet()->setCellValue('C' . $k, $row['goods_sn']);
             $objPHPExcel->getActiveSheet()->setCellValue('D' . $k, $row['goods_name']);
             $objPHPExcel->getActiveSheet()->setCellValue('E' . $k, empty($row['goods_cate_sub']) ? $row['goods_cate'] : $row['goods_cate_sub']);
             $brand_name = !empty($row['brand_name']) ? trim(stripcslashes(strip_tags(nl2br($row['brand_name'])))) : '---';
             $objPHPExcel->getActiveSheet()->setCellValue('F' . $k, $brand_name);
             $objPHPExcel->getActiveSheet()->setCellValue('G' . $k, $row['goods_brief']);
             $objPHPExcel->getActiveSheet()->setCellValue('H' . $k, $row['goods_weight']);
             $objPHPExcel->getActiveSheet()->setCellValue('I' . $k, '');
             $objPHPExcel->getActiveSheet()->setCellValue('J' . $k, '');
             $objPHPExcel->getActiveSheet()->setCellValue('K' . $k, '');
             $objPHPExcel->getActiveSheet()->setCellValue('L' . $k, $row['goods_unit']);
             $objPHPExcel->getActiveSheet()->setCellValue('M' . $k, $row['market_price']);
             $objPHPExcel->getActiveSheet()->setCellValue('N' . $k, $row['pifa_price']);
             $objPHPExcel->getActiveSheet()->setCellValue('O' . $k, $row['shop_price']);
             $objPHPExcel->getActiveSheet()->setCellValue('P' . $k, $row['goods_number']);
             $objPHPExcel->getActiveSheet()->setCellValue('Q' . $k, $row['warn_number']);
             $objPHPExcel->getActiveSheet()->setCellValue('R' . $k, $row['meta_keys']);
             $objPHPExcel->getActiveSheet()->setCellValue('S' . $k, $row['meta_desc']);
             $objPHPExcel->getActiveSheet()->setCellValue('T' . $k, '');
             $objPHPExcel->getActiveSheet()->setCellValue('U' . $k, '');
             $objPHPExcel->getActiveSheet()->setCellValue('V' . $k, $row['original_img']);
             $objPHPExcel->getActiveSheet()->setCellValue('W' . $k, '');
         }
     }
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $m_strOutputExcelFileName = (empty($cname) ? '商品列表' : $cname) . date('Y-m-j_H_i_s') . ".xls";
     // 输出EXCEL文件名
     header("Pragma: public");
     header("Expires: 0");
     header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
     header("Content-Type:application/force-download");
     header("Content-Type: application/vnd.ms-excel;");
     header("Content-Type:application/octet-stream");
     header("Content-Type:application/download");
     header("Content-Disposition:attachment;filename=" . $m_strOutputExcelFileName);
     header("Content-Transfer-Encoding:binary");
     $objWriter->save("php://output");
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:101,代码来源:controller.php

示例14: hacerReporte

 public function hacerReporte()
 {
     error_reporting(E_ALL);
     ini_set('display_errors', TRUE);
     ini_set('display_startup_errors', TRUE);
     date_default_timezone_set('Europe/London');
     if (PHP_SAPI == 'cli') {
         die('This example should only be run from a Web Browser');
     }
     // Create new PHPExcel object
     $objPHPExcel = new PHPExcel();
     // Set document properties
     $objPHPExcel->getProperties()->setCreator("Inmobiliaria Castilla")->setLastModifiedBy("Inmobiliaria Castilla")->setTitle("Enganches Parciales")->setSubject("Enganches Parciales")->setDescription("Enganches Parciales")->setKeywords("office 2007 openxml php")->setCategory("Enganches Parciales");
     $objPHPExcel->getActiveSheet()->setTitle('Enganches');
     //Imagen
     $objDrawing = new PHPExcel_Worksheet_Drawing();
     $objDrawing->setName('imagenCastilla');
     $objDrawing->setDescription('Imagen de inmobiliaria Castilla');
     $objDrawing->setPath('img/logo.jpg');
     $objDrawing->setHeight(35);
     $objDrawing->setCoordinates('B2');
     $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
     $objPHPExcel->setActiveSheetIndex()->mergeCells('F2:O2');
     for ($columna = 'B'; $columna <= 'O'; $columna++) {
         $objPHPExcel->getActiveSheet()->getColumnDimension($columna)->setAutoSize(true);
     }
     $objPHPExcel->getActiveSheet()->setCellValue('F2', 'Enganches Parciales Del Desarrollo ' . $this->enganches_parciales['desarrollo'][0]->nombre);
     $objPHPExcel->getActiveSheet()->getStyle('F2:O2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
     $objPHPExcel->getActiveSheet()->setCellValue('F4', 'Fecha del reporte')->setCellValue('G4', date('Y-m-d'))->setCellValue('F6', 'Cliente')->setCellValue('G6', 'Expediente')->setCellValue('H6', 'Manzana')->setCellValue('I6', 'Lote')->setCellValue('J6', 'Fecha promesa')->setCellValue('K6', 'Importe prometido')->setCellValue('L6', 'Estado');
     $renglon = 7;
     for ($enganche = 0; $enganche < count($this->enganches_parciales['enganches']); $enganche++) {
         if ($this->enganches_parciales['enganches'][$enganche]->tipo == 1) {
             $cliente = $this->enganches_parciales['enganches'][$enganche]->nombre . " " . $this->enganches_parciales['enganches'][$enganche]->ape_pate . " " . $this->enganches_parciales['enganches'][$enganche]->ape_mate;
         } else {
             $cliente = $this->enganches_parciales['enganches'][$enganche]->denominacion;
         }
         if ($this->enganches_parciales['enganches'][$enganche]->estado < 2) {
             $estado = "Adeudado";
         } else {
             if ($this->enganches_parciales['enganches'][$enganche]->estado == 2) {
                 $estado = "Adeudo a moratorios";
             } else {
                 $estado = "Pagado";
             }
         }
         $objPHPExcel->getActiveSheet()->setCellValue('F' . $renglon, $cliente)->setCellValue('G' . $renglon, $this->enganches_parciales['enganches'][$enganche]->id_expediente)->setCellValue('H' . $renglon, $this->enganches_parciales['enganches'][$enganche]->num_letra)->setCellValue('I' . $renglon, $this->enganches_parciales['enganches'][$enganche]->lote)->setCellValue('J' . $renglon, $this->enganches_parciales['enganches'][$enganche]->fecha_promesa)->setCellValue('K' . $renglon, round($this->enganches_parciales['enganches'][$enganche]->importe, 2))->setCellValue('L' . $renglon, $estado);
         $renglon++;
     }
     // Redirect output to a client’s web browser (Excel5)
     header('Content-Type: application/vnd.ms-excel');
     header('Content-Disposition: attachment;corrida_financiera.xls"');
     header('Cache-Control: max-age=0');
     // If you're serving to IE 9, then the following may be needed
     header('Cache-Control: max-age=1');
     // If you're serving to IE over SSL, then the following may be needed
     header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
     // Date in the past
     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     // always modified
     header('Cache-Control: cache, must-revalidate');
     // HTTP/1.1
     header('Pragma: public');
     // HTTP/1.0
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:vipomx,项目名称:Castilla,代码行数:67,代码来源:reporteEnganches1.php

示例15: postAction


//.........这里部分代码省略.........
         $objPHPExcel->getActiveSheet()->getStyle('A1:D1')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('G1')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('A2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('B2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('C2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('D2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('E2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('F2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('G2')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('A3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('B3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('C3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('D3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('E3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('F3')->applyFromArray($styleThinBlackBorderOutline);
         $objPHPExcel->getActiveSheet()->getStyle('G3')->applyFromArray($styleThinBlackBorderOutline);
         // Set fills
         //echo date('H:i:s') , " Set fills" , EOL;
         $objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
         $objPHPExcel->getActiveSheet()->getStyle('A1:G1')->getFill()->getStartColor()->setARGB('FFFFFF');
         $objPHPExcel->getActiveSheet()->getStyle('A2:G2')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
         $objPHPExcel->getActiveSheet()->getStyle('A2:G2')->getFill()->getStartColor()->setARGB('FFFFFF');
         // Set style for header row using alternative method
         //echo date('H:i:s') , " Set style for header row using alternative method" , EOL;
         $objPHPExcel->getActiveSheet()->getStyle('A3:G3')->applyFromArray(array('font' => array('bold' => true), 'borders' => array('top' => array('style' => PHPExcel_Style_Border::BORDER_THIN))));
         // 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('Logo');
         $objDrawing->setDescription('Logo');
         $objDrawing->setPath('./images/logo.png');
         $objDrawing->setHeight(133);
         $objDrawing->setWidth(281);
         $objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
         //$post['id'] = array("1","2","3","4","5");
         $products = Mage::getModel('catalog/product')->getCollection();
         $products->addAttributeToSelect('*');
         $prodIds = $products->getAllIds();
         $product = Mage::getModel('catalog/product');
         $counter_test = 0;
         $i = 4;
         foreach ($post['id'] as $productId) {
             if (++$counter_test < 30000) {
                 $product->load($productId);
                 $style_number = str_replace('"', '', $product->getSku());
                 $image_link = $product->getImage();
                 $description = htmlspecialchars(iconv("UTF-8", "UTF-8//IGNORE", $product->getDescription()));
                 $product->setCustomerGroupId(2);
                 $wholesale = number_format($product->getPriceModel()->getFinalPrice(1, $product), 2);
                 $price_temp = round($product->getPrice(), 2);
                 $price = round($product->getPrice(), 2);
                 $special_price = number_format($product->getSpecialPrice(), 2);
                 $qty = $product->getStockItem()->getQty();
                 $objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(190);
                 //Infromation 1
                 $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $style_number);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getAlignment()->setIndent(9);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getFont()->setName('Arial')->setSize(10)->getColor()->setRGB('000000');
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getFont()->setBold(true);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i . ':G' . $i)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i . ':G' . $i)->getFill()->getStartColor()->setARGB('FFFFFF');
                 $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->applyFromArray($styleThinBlackBorderOutline);
                 //Extra Block
                 $objPHPExcel->getActiveSheet()->getStyle('D' . $i)->applyFromArray($styleThinBlackBorderOutline);
                 $objPHPExcel->getActiveSheet()->getStyle('E' . $i)->applyFromArray($styleThinBlackBorderOutline);
开发者ID:planetwebsolution,项目名称:Magento-Sample-Code,代码行数:67,代码来源:MyformController.php


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