本文整理汇总了PHP中PHPExcel_Worksheet_Drawing::setHeight方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet_Drawing::setHeight方法的具体用法?PHP PHPExcel_Worksheet_Drawing::setHeight怎么用?PHP PHPExcel_Worksheet_Drawing::setHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Worksheet_Drawing
的用法示例。
在下文中一共展示了PHPExcel_Worksheet_Drawing::setHeight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
//.........这里部分代码省略.........
if (isset($shape['style'])) {
$style = (string)$shape['style'];
$fillColor = strtoupper( substr( (string)$shape['fillcolor'], 1 ) );
$column = null;
$row = null;
$clientData = $shape->xpath('.//x:ClientData');
if (is_array($clientData) && count($clientData) > 0) {
$clientData = $clientData[0];
if ( isset($clientData['ObjectType']) && (string)$clientData['ObjectType'] == 'Note' ) {
$temp = $clientData->xpath('.//x:Row');
if (is_array($temp)) $row = $temp[0];
$temp = $clientData->xpath('.//x:Column');
if (is_array($temp)) $column = $temp[0];
}
}
if (!is_null($column) && !is_null($row)) {
// Set comment properties
$comment = $docSheet->getCommentByColumnAndRow($column, $row + 1);
$comment->getFillColor()->setRGB( $fillColor );
// Parse style
$styleArray = explode(';', str_replace(' ', '', $style));
foreach ($styleArray as $stylePair) {
$stylePair = explode(':', $stylePair);
if ($stylePair[0] == 'margin-left') $comment->setMarginLeft($stylePair[1]);
if ($stylePair[0] == 'margin-top') $comment->setMarginTop($stylePair[1]);
if ($stylePair[0] == 'width') $comment->setWidth($stylePair[1]);
if ($stylePair[0] == 'height') $comment->setHeight($stylePair[1]);
if ($stylePair[0] == 'visibility') $comment->setVisible( $stylePair[1] == 'visible' );
}
}
}
}
}
// Header/footer images
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
if ($zip->locateName(dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("$dir/$fileWorksheet") . "/_rels/" . basename($fileWorksheet) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$vmlRelationship = '';
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
$vmlRelationship = self::dir_add("$dir/$fileWorksheet", $ele["Target"]);
}
}
if ($vmlRelationship != '') {
// Fetch linked images
$relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels' )); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$drawings = array();
foreach ($relsVML->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$drawings[(string) $ele["Id"]] = self::dir_add($vmlRelationship, $ele["Target"]);
}
}
// Fetch VML document
$vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship));
示例2: 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;
}
示例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("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;
}
示例4: 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);
}
示例5: 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);
}
示例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);
}
}
}
示例7: receta_generate_xlsx
public function receta_generate_xlsx($params = array(), $save = false)
{
$title = array_key_exists('title', $params) ? $params['title'] : 'IS_XLSX';
$items_recetas = array_key_exists('items_receta', $params) ? $params['items_receta'] : false;
$headers_receta = array_key_exists('headers_receta', $params) ? $params['headers_receta'] : false;
$items_valores = array_key_exists('items_valores', $params) ? $params['items_valores'] : false;
$headers_valores = array_key_exists('headers_valores', $params) ? $params['headers_valores'] : false;
$headers_costo_total = array_key_exists('headers_costo_total', $params) ? $params['headers_costo_total'] : false;
$items_costo_total = array_key_exists('items_costo_total', $params) ? $params['items_costo_total'] : false;
$preparacion = array_key_exists('preparacion', $params) ? $params['preparacion'] : false;
if ($items_recetas && $headers_receta && $items_valores && $headers_valores) {
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("IS Intelligent Solution")->setLastModifiedBy("IS Intelligent Solution")->setTitle($title)->setSubject($title)->setDescription($title)->setKeywords("office 2007 openxml");
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./assets/images/logo.png');
$objDrawing->setHeight(36);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$countHeadersReceta = count($params['headers_receta']) + 64;
$columnReceta = chr($countHeadersReceta) . '3';
$total_valores = count($params['items_valores']);
$inicio_total = 'D' . (count($params['items_valores']) + 7);
$unidad_total = 'D' . (count($params['items_valores']) + 6);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(22);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objPHPExcel->getActiveSheet()->getStyle("A1:" . chr($countHeadersReceta) . '1')->applyFromArray($this->defaultStyle_headers());
/*$objPHPExcel->getActiveSheet()->mergeCells('G1:K1')->getStyle("G1:K1")->applyFromArray($this->defaultStyle_aviso());
$objPHPExcel->getActiveSheet()->mergeCells('G2:K2')->getStyle("G2:K2")->applyFromArray($this->defaultStyle_aviso());
$objPHPExcel->getActiveSheet()->mergeCells('G3:K3')->getStyle("G3:K3")->applyFromArray($this->defaultStyle_aviso());
$objPHPExcel->getActiveSheet()->mergeCells('G4:K4')->getStyle("G4:K4")->applyFromArray($this->defaultStyle_aviso());*/
$objPHPExcel->getActiveSheet()->setCellValue('C1', $title);
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->fromArray($params['headers_receta'], null, 'A3');
$objPHPExcel->getActiveSheet()->getStyle("A3:{$columnReceta}")->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->fromArray($params['headers_valores'], null, 'A6');
$objPHPExcel->getActiveSheet()->getStyle("A6:AC6")->applyFromArray($this->defaultStyle_headers());
foreach (range('A', $columnReceta) as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
for ($i = "A"; $i != "AE"; $i++) {
$objPHPExcel->getActiveSheet()->getColumnDimension($i)->setAutoSize(true);
}
foreach (range('A', $columnReceta) as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
$items = $objPHPExcel->getActiveSheet()->fromArray($params['items_receta'], null, 'A4');
$objPHPExcel->setActiveSheetIndex(0);
$items = $objPHPExcel->getActiveSheet()->fromArray($params['items_valores'], null, 'A7');
$objPHPExcel->setActiveSheetIndex(0);
for ($i = 'E'; $i != 'AD'; $i++) {
$objPHPExcel->getActiveSheet()->mergeCells('K' . (count($params['items_valores']) + 9) . ':O' . (count($params['items_valores']) + 9));
$objPHPExcel->getActiveSheet()->setCellValue('E' . (count($params['items_valores']) + 7), 'Costo Total $');
$objPHPExcel->getActiveSheet()->setCellValue('F' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('G' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('H' . (count($params['items_valores']) + 7), '(kcal.)');
$objPHPExcel->getActiveSheet()->setCellValue('I' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('J' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('K' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('L' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('M' . (count($params['items_valores']) + 7), '(µg RE.)');
$objPHPExcel->getActiveSheet()->setCellValue('N' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('O' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('P' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('Q' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('R' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('S' . (count($params['items_valores']) + 7), '(.)');
$objPHPExcel->getActiveSheet()->setCellValue('T' . (count($params['items_valores']) + 7), '(.)');
$objPHPExcel->getActiveSheet()->setCellValue('U' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('V' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('W' . (count($params['items_valores']) + 7), '(mcg.)');
$objPHPExcel->getActiveSheet()->setCellValue('X' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('Y' . (count($params['items_valores']) + 7), '(mg.)');
$objPHPExcel->getActiveSheet()->setCellValue('Z' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('AA' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('AB' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('AC' . (count($params['items_valores']) + 7), '(g.)');
$objPHPExcel->getActiveSheet()->setCellValue('E' . (count($params['items_valores']) + 9), 'Costo Porción $');
$objPHPExcel->getActiveSheet()->getStyle($i . (count($params['items_valores']) + 8) . ':AC' . (count($params['items_valores']) + 8))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle($i . (count($params['items_valores']) + 10) . ':AC' . (count($params['items_valores']) + 10))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle($i . (count($params['items_valores']) + 7) . ':' . $i . (count($params['items_valores']) + 7))->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->getStyle($i . (count($params['items_valores']) + 9) . ':' . $i . (count($params['items_valores']) + 9))->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->setCellValue($i . (count($params['items_valores']) + 8), '=SUM(' . $i . '7:' . $i . (count($params['items_valores']) + 7) . ')');
$objPHPExcel->getActiveSheet()->setCellValue($i . (count($params['items_valores']) + 10), '=(' . $i . (count($params['items_valores']) + 8) . '/D4)');
$objPHPExcel->setActiveSheetIndex(0);
}
$objPHPExcel->getActiveSheet()->getStyle('A' . (count($params['items_valores']) + 12) . ':O' . (count($params['items_valores']) + 12))->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->mergeCells('A' . (count($params['items_valores']) + 12) . ':O' . (count($params['items_valores']) + 12));
$objPHPExcel->getActiveSheet()->setCellValue('A' . (count($params['items_valores']) + 12), 'PREPARACIÓN');
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->getRowDimension(count($params['items_valores']) + 13)->setRowHeight(40);
$objPHPExcel->getActiveSheet()->getStyle('A' . (count($params['items_valores']) + 13) . ':O' . (count($params['items_valores']) + 13))->getBorders()->getAllBorders()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->mergeCells('A' . (count($params['items_valores']) + 13) . ':O' . (count($params['items_valores']) + 13));
$objPHPExcel->getActiveSheet()->setCellValue('A' . (count($params['items_valores']) + 13), $params['preparacion'][0][0]);
$objPHPExcel->setActiveSheetIndex(0);
if ($save) {
$pathfile = 'assets/docs/' . $title . '.xlsx';
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//.........这里部分代码省略.........
示例8: almacenes_xlsx
public function almacenes_xlsx($params = array(), $save = false)
{
//print_debug($params['headers']);
$headers_pasillos = array_key_exists('headers_pasillos', $params) ? $params['headers_pasillos'] : false;
$items_pasillo = array_key_exists('items_pasillo', $params) ? $params['items_pasillo'] : false;
$headers_gabetas = array_key_exists('headers_gabetas', $params) ? $params['headers_gabetas'] : false;
$items_gabeta = array_key_exists('items_gabeta', $params) ? $params['items_gabeta'] : false;
$title = array_key_exists('title', $params) ? $params['title'] : 'IS_XLSX';
$headers = array_key_exists('headers', $params) ? $params['headers'] : false;
$items = array_key_exists('items', $params) ? $params['items'] : false;
//print_debug($headers);
if ($headers && $items) {
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("IS Intelligent Solution")->setLastModifiedBy("IS Intelligent Solution")->setTitle($title)->setSubject($title)->setDescription($title)->setKeywords("office 2007 openxml");
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./assets/images/logo.png');
$objDrawing->setHeight(36);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$countHeaders = count($params['headers']) + 66;
$column = chr($countHeaders) . '3';
$countHeadersPasillo = count($params['headers_pasillos']) + 64;
$columnPasillo = chr($countHeadersPasillo) . '6';
$countHeadersGabeta = count($params['headers_gabetas']) + 68;
$columnGabeta = chr($countHeadersGabeta) . '6';
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setName('Candara');
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(22);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objPHPExcel->getActiveSheet()->getStyle("A1:G1")->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->setCellValue('E1', $title);
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->fromArray($params['headers'], null, 'A3');
$objPHPExcel->getActiveSheet()->getStyle("A3:E3")->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->fromArray($params['headers_pasillos'], null, 'A6');
$objPHPExcel->getActiveSheet()->getStyle("A6:{$columnPasillo}")->applyFromArray($this->defaultStyle_headers());
$objPHPExcel->getActiveSheet()->fromArray($params['headers_gabetas'], null, 'E6');
$objPHPExcel->getActiveSheet()->getStyle("E6:{$columnGabeta}")->applyFromArray($this->defaultStyle_headers());
foreach (range('A', $column) as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
foreach (range('A', $columnPasillo) as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
foreach (range('E', $columnPasillo) as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
$items = $objPHPExcel->getActiveSheet()->fromArray($params['items'], null, 'A4');
$objPHPExcel->setActiveSheetIndex(0);
$items_pasillo = $objPHPExcel->getActiveSheet()->fromArray($params['items_pasillo'], null, 'A7');
$objPHPExcel->setActiveSheetIndex(0);
$items_pasillo = $objPHPExcel->getActiveSheet()->fromArray($params['items_gabeta'], null, 'E7');
$objPHPExcel->setActiveSheetIndex(0);
if ($save) {
$pathfile = 'assets/docs/' . $title . '.xlsx';
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save(str_replace('.php', '.xlsx', __FILE__));
rename(APPPATH . 'libraries/excel.xlsx', $pathfile);
return $pathfile;
} else {
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="' . $title . '.xlsx"');
ob_end_clean();
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('php://output');
exit;
}
} else {
redirect('override_404');
}
}
示例9: insert_bitmap
/**
* Insert an image in a worksheet.
*
* @param integer $row The row we are going to insert the bitmap into
* @param integer $col The column we are going to insert the bitmap into
* @param string $bitmap The bitmap filename
* @param integer $x The horizontal position (offset) of the image inside the cell.
* @param integer $y The vertical position (offset) of the image inside the cell.
* @param integer $scale_x The horizontal scale
* @param integer $scale_y The vertical scale
*/
public function insert_bitmap($row, $col, $bitmap, $x = 0, $y = 0, $scale_x = 1, $scale_y = 1)
{
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath($bitmap);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1));
$objDrawing->setOffsetX($x);
$objDrawing->setOffsetY($y);
$objDrawing->setWorksheet($this->worksheet);
if ($scale_x != 1) {
$objDrawing->setResizeProportional(false);
$objDrawing->getWidth($objDrawing->getWidth() * $scale_x);
}
if ($scale_y != 1) {
$objDrawing->setResizeProportional(false);
$objDrawing->setHeight($objDrawing->getHeight() * $scale_y);
}
}
示例10:
$objPHPExcel->setActiveSheetIndex(1);
//Seleccionar la pestaña deseada
$objPHPExcel->getActiveSheet()->setTitle("Graficas");
//Establecer nombre para la pestaña
//reiniciar cell en la nueva pestaña
$cell = 2;
// objeto PHPExcel_Worksheet_Drawing para agregar la imagen
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName($foto);
$objDrawing->setDescription('Logo');
$logo = $foto;
// Provide path to your logo file
$objDrawing->setPath($logo);
//setOffsetY has no effect
$objDrawing->setCoordinates('B' . $cell);
$objDrawing->setHeight(500);
// logo height
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$cell = $cell + 14;
// Se activa la hoja 0 de Empresas para mostrar como principal
$objPHPExcel->setActiveSheetIndex(0);
//FIN EXCEL
$writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
// This line will force the file to download
$writer->save('php://output');
} else {
echo "no hay data";
}
}
/*
TITULOS DEL REPORTE
示例11: load
//.........这里部分代码省略.........
$row = null;
$clientData = $shape->xpath('.//x:ClientData');
if (is_array($clientData) && !empty($clientData)) {
$clientData = $clientData[0];
if (isset($clientData['ObjectType']) && (string) $clientData['ObjectType'] == 'Note') {
$temp = $clientData->xpath('.//x:Row');
if (is_array($temp)) {
$row = $temp[0];
}
$temp = $clientData->xpath('.//x:Column');
if (is_array($temp)) {
$column = $temp[0];
}
}
}
if ($column !== NULL && $row !== NULL) {
// Set comment properties
$comment = $docSheet->getCommentByColumnAndRow((string) $column, $row + 1);
$comment->getFillColor()->setRGB($fillColor);
// Parse style
$styleArray = explode(';', str_replace(' ', '', $style));
foreach ($styleArray as $stylePair) {
$stylePair = explode(':', $stylePair);
if ($stylePair[0] == 'margin-left') {
$comment->setMarginLeft($stylePair[1]);
}
if ($stylePair[0] == 'margin-top') {
$comment->setMarginTop($stylePair[1]);
}
if ($stylePair[0] == 'width') {
$comment->setWidth($stylePair[1]);
}
if ($stylePair[0] == 'height') {
$comment->setHeight($stylePair[1]);
}
if ($stylePair[0] == 'visibility') {
$comment->setVisible($stylePair[1] == 'visible');
}
}
}
}
}
}
// Header/footer images
if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
if ($zip->locateName(dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels")) {
$relsWorksheet = simplexml_load_string($this->_getFromZipArchive($zip, dirname("{$dir}/{$fileWorksheet}") . "/_rels/" . basename($fileWorksheet) . ".rels"));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$vmlRelationship = '';
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
$vmlRelationship = self::dir_add("{$dir}/{$fileWorksheet}", $ele["Target"]);
}
}
if ($vmlRelationship != '') {
// Fetch linked images
$relsVML = simplexml_load_string($this->_getFromZipArchive($zip, dirname($vmlRelationship) . '/_rels/' . basename($vmlRelationship) . '.rels'));
//~ http://schemas.openxmlformats.org/package/2006/relationships");
$drawings = array();
foreach ($relsVML->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$drawings[(string) $ele["Id"]] = self::dir_add($vmlRelationship, $ele["Target"]);
}
}
// Fetch VML document
$vmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $vmlRelationship));
示例12: index
//.........这里部分代码省略.........
$rc++;
$this->myexcel->getActiveSheet()->getStyle('B' . $rc)->applyFromArray($styleArray8);
$this->myexcel->getActiveSheet()->getStyle('B' . $rc . ':R' . $rc)->applyFromArray($styleArray9);
$this->myexcel->getActiveSheet()->mergeCells('B' . ($rc - 1) . ':R' . $rc);
$this->myexcel->getActiveSheet()->setCellValue('S' . $rc, '=IF(S' . ($rc - 1) . '<=50,"Buruk",IF(S' . ($rc - 1) . '<=60,"Sedang",IF(S' . ($rc - 1) . '<=75,"Cukup",IF(S' . ($rc - 1) . '<=90.99,"Baik","Sangat Baik"))))');
$this->myexcel->getActiveSheet()->getStyle('S' . $rc)->applyFromArray($styleArray10b);
$rc++;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
$this->myexcel->createSheet(NULL, 2);
$this->myexcel->setActiveSheetIndex(2);
$this->myexcel->getActiveSheet()->setTitle('PENILAIAN');
//$this->myexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3);
$this->myexcel->getActiveSheet()->getPageSetup()->setPaperSize(PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL);
$this->myexcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$this->myexcel->getActiveSheet()->getPageSetup()->setScale(75);
$this->myexcel->getActiveSheet()->getPageMargins()->setTop(0.7);
$this->myexcel->getActiveSheet()->getPageMargins()->setRight(0.1);
$this->myexcel->getActiveSheet()->getPageMargins()->setBottom(0.4);
$this->myexcel->getActiveSheet()->getPageMargins()->setLeft(0.4);
$this->myexcel->getActiveSheet()->getColumnDimension("A")->setWidth(3);
$this->myexcel->getActiveSheet()->getColumnDimension("B")->setWidth('3');
$this->myexcel->getActiveSheet()->getColumnDimension("C")->setWidth('20');
$this->myexcel->getActiveSheet()->getColumnDimension("D")->setWidth('14');
$this->myexcel->getActiveSheet()->getColumnDimension("E")->setWidth('14');
$this->myexcel->getActiveSheet()->getColumnDimension("J")->setWidth('4');
$this->myexcel->getActiveSheet()->getColumnDimension("K")->setWidth('4');
$this->myexcel->getActiveSheet()->getColumnDimension("L")->setWidth('3');
$this->myexcel->getActiveSheet()->getColumnDimension("V")->setWidth(3);
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('PHPExcel logo');
$objDrawing->setDescription('PHPExcel logo');
$objDrawing->setPath('assets/images/garuda.gif');
// filesystem reference for the image file
$objDrawing->setHeight(100);
// sets the image height to 36px (overriding the actual image height);
$objDrawing->setCoordinates('P29');
// pins the top-left corner of the image to cell D24
$objDrawing->setOffsetX(35);
// pins the top left corner of the image at an offset of 10 points horizontally to the right of the top-left corner of the cell
$objDrawing->setWorksheet($this->myexcel->getActiveSheet());
$rc = 3;
$this->myexcel->getActiveSheet()->getRowDimension($rc)->setRowHeight(30);
$this->myexcel->getActiveSheet()->setCellValue('B' . $rc, '4.');
$this->myexcel->getActiveSheet()->getStyle('B' . $rc)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$this->myexcel->getActiveSheet()->getStyle('B' . $rc)->applyFromArray($styleArray8aa);
$this->myexcel->getActiveSheet()->setCellValue('C' . $rc, 'UNSUR YANG DINILAI');
$this->myexcel->getActiveSheet()->getStyle('C' . $rc)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$this->myexcel->getActiveSheet()->getStyle('C' . $rc . ':H' . $rc)->applyFromArray($styleArray8b);
$this->myexcel->getActiveSheet()->mergeCells('C' . $rc . ':H' . $rc);
$this->myexcel->getActiveSheet()->setCellValue('I' . $rc, 'JUMLAH');
$this->myexcel->getActiveSheet()->getStyle('I' . $rc)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$this->myexcel->getActiveSheet()->getStyle('I' . $rc)->applyFromArray($styleArray8c);
$this->myexcel->getActiveSheet()->getStyle('I' . $rc)->applyFromArray($styleArray8h);
$this->myexcel->getActiveSheet()->setCellValue('L' . $rc, '6. TANGGAPAN PEJABAT PENILAI ATAS KEBERATAN');
$this->myexcel->getActiveSheet()->getStyle('L' . $rc)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
$this->myexcel->getActiveSheet()->getStyle('L' . $rc)->applyFromArray($styleArray8aa);
$this->myexcel->getActiveSheet()->getStyle('M' . $rc . ':T' . $rc)->applyFromArray($styleArray8g);
$this->myexcel->getActiveSheet()->getStyle('U' . $rc)->applyFromArray($styleArray8h);
$rc++;
$this->myexcel->getActiveSheet()->getStyle('B' . $rc)->applyFromArray($styleArray8ba);
$this->myexcel->getActiveSheet()->getRowDimension($rc)->setRowHeight(30);
$this->myexcel->getActiveSheet()->setCellValue('C' . $rc, 'a. Sasaran Kerja Pegawai (SKP)');
$this->myexcel->getActiveSheet()->getStyle('C' . $rc . ':E' . $rc)->applyFromArray($styleArray8c);
$this->myexcel->getActiveSheet()->setCellValue('F' . $rc, '=PENGUKURAN!S' . $r_nilai);
$this->myexcel->getActiveSheet()->getStyle('F' . $rc)->applyFromArray($styleArray8c);
$this->myexcel->getActiveSheet()->setCellValue('G' . $rc, 'x');
示例13: excel
function excel()
{
//load our new PHPExcel library
$this->load->library('excel');
//activate worksheet number 1
$this->excel->setActiveSheetIndex(0);
//name the worksheet
$this->excel->getActiveSheet()->setTitle('Master Barang');
$this->excel->getActiveSheet()->mergeCells('A1:G6');
//$this->excel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('D:/logo-po.jpg');
$objDrawing->setCoordinates('C1');
$objDrawing->setOffsetX(150);
$objDrawing->setHeight(108);
$objDrawing->setWidth(637);
$objDrawing->setWorksheet($this->excel->getActiveSheet());
//$this->excel->getActiveSheet()->setCellValue('C1', 'PT Gramaselindo');
$this->excel->getActiveSheet()->setCellValue('A7', 'No');
$this->excel->getActiveSheet()->setCellValue('B7', 'Kode');
$this->excel->getActiveSheet()->setCellValue('C7', 'Deskripsi');
$this->excel->getActiveSheet()->setCellValue('D7', 'Alias');
$this->excel->getActiveSheet()->setCellValue('E7', 'Jenis Barang');
$this->excel->getActiveSheet()->setCellValue('F7', 'Satuan Dasar');
$this->excel->getActiveSheet()->setCellValue('G7', 'Satuan Laporan');
for ($col = ord('A'); $col <= ord('F'); $col++) {
//set column dimension
$this->excel->getActiveSheet()->getColumnDimension(chr($col))->setAutoSize(false);
//change the font size
$this->excel->getActiveSheet()->getStyle(chr($col))->getFont()->setSize(12);
}
$this->excel->getActiveSheet()->getStyle(chr(ord('A')))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle(chr(ord('B')))->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle(chr(ord('C')))->getAlignment()->setWrapText(true);
$this->excel->getActiveSheet()->getStyle(chr(ord('D')))->getAlignment()->setWrapText(true);
$this->excel->getActiveSheet()->getColumnDimension('C')->setWidth(75);
$this->excel->getActiveSheet()->getColumnDimension('D')->setWidth(25);
$this->excel->getActiveSheet()->getColumnDimension('E')->setWidth(20);
$this->excel->getActiveSheet()->getColumnDimension('F')->setWidth(20);
$this->excel->getActiveSheet()->getColumnDimension('G')->setWidth(20);
$rs = $this->barang->get_barang();
//print_//mz($rs);
$exceldata = "";
foreach ($rs as $row) {
$exceldata[] = $row;
}
//Fill data
$this->excel->getActiveSheet()->fromArray($exceldata, null, 'A8');
$this->excel->getActiveSheet()->getStyle('A7')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('B7')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('C7')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$this->excel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$filename = 'Master Barang.xls';
//save our workbook as this file name
header('Content-Type: application/vnd.ms-excel');
//mime type
header('Content-Disposition: attachment;filename="' . $filename . '"');
//tell browser what's the file name
header('Cache-Control: max-age=0');
//no cache
//save it to Excel5 format (excel 2003 .XLS file), change this to 'Excel2007' (and adjust the filename extension, also the header mime type)
//if you want to save it as .XLSX Excel 2007 format
$objWriter = PHPExcel_IOFactory::createWriter($this->excel, 'Excel5');
//force user to download the Excel file without writing it to server's HD
$objWriter->save('php://output');
}
示例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;
}
示例15: 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("Cobranza Proyectada")->setSubject("Cobranza Proyectada")->setDescription("Cobranza Proyectada")->setKeywords("office 2007 openxml php")->setCategory("Cobranza Proyectada");
$objPHPExcel->getActiveSheet()->setTitle('Cobranza');
//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 = 'A'; $columna <= 'D'; $columna++) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columna)->setAutoSize(true);
}
$objPHPExcel->getActiveSheet()->setCellValue('F2', 'Cobranza Proyectada');
$objPHPExcel->getActiveSheet()->getStyle('F2:O2')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->setCellValue('F3', 'Fecha de reporte')->setCellValue('G3', date('Y-m-d'));
$columna = 'F';
$objPHPExcel->getActiveSheet()->setCellValue('B6', 'Expediente')->setCellValue('C6', 'Cliente')->setCellValue('D6', 'Mes');
$anio = 0;
$mes = 0;
$meses = array(1 => 'Enero', 2 => 'Febrero', 3 => 'Marzo', 4 => 'Abril', 5 => 'Mayo', 6 => 'Junio', 7 => 'Julio', 8 => 'Agosto', 9 => 'Septiembre', 10 => 'Octubre', 11 => 'Noviembre', 12 => 'Diciembre');
$fecha = $this->cobranza['fechaInicio'];
$num_columnas = 0;
while (strtotime($fecha) <= strtotime($this->cobranza['fechaFinal'])) {
$f = explode('-', $fecha);
$anio = $f[0];
$mes = $f[1];
if ($mes[0] == '0') {
$mes = $mes[1];
}
$objPHPExcel->getActiveSheet()->setCellValue($columna . '6', $meses[$mes] . ' ' . $anio);
$objPHPExcel->getActiveSheet()->getColumnDimension($columna)->setAutoSize(true);
$columna++;
if ($mes == 12) {
$anio++;
$mes = 1;
} else {
$mes++;
}
$fecha = $anio . '-' . $mes . '-1';
// Acumadores para las distintos meses
$acum_meses[$num_columnas] = 0;
$num_columnas++;
}
$ultima_columna = $columna;
$renglon = 8;
$total = 0;
for ($desarrollo = 0; $desarrollo < count($this->cobranza['cobranza']); $desarrollo++) {
$objPHPExcel->setActiveSheetIndex()->mergeCells('F' . $renglon . ':N' . $renglon);
$objPHPExcel->getActiveSheet()->getStyle('F' . $renglon . ':N' . $renglon)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
$objPHPExcel->getActiveSheet()->setCellValue('F' . $renglon, $this->cobranza['cobranza'][$desarrollo]['desarrollo']->nombre);
$renglon += 2;
for ($expediente = 0; $expediente < count($this->cobranza['cobranza'][$desarrollo]['expedientes']); $expediente++) {
if ($this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['cliente']->tipo == 1) {
$cliente = $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['cliente']->nombre . ' ' . $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['cliente']->ape_pate . ' ' . $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['cliente']->ape_mate;
} else {
$cliente = $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['cliente']->denominacion;
}
$objPHPExcel->getActiveSheet()->setCellValue('B' . $renglon, $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['expediente']->id_expediente)->setCellValue('C' . $renglon, $cliente);
if ($this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'] != null) {
$fechaInicio = explode('-', $this->cobranza['fechaInicio']);
$f = explode('-', $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'][0]['fecha_vence']);
$anios = $f[0] - $fechaInicio[0];
$meses = $f[1] - $fechaInicio[1] + 12 * $anios;
$columna = 'F';
$i = 0;
while ($i < $meses) {
$columna++;
$i++;
}
} else {
continue;
}
$cli_total = 0;
for ($mensualidad = 0; $mensualidad < count($this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades']); $mensualidad++) {
$t = $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'][$mensualidad]['capital'] + $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'][$mensualidad]['actualizacion'] + $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'][$mensualidad]['admon_cobra'] + $this->cobranza['cobranza'][$desarrollo]['expedientes'][$expediente]['mensualidades'][$mensualidad]['interes'];
$acum_meses[$meses] += $t;
$meses++;
$cli_total += $t;
$objPHPExcel->getActiveSheet()->setCellValue($columna . $renglon, $t);
$columna++;
}
$objPHPExcel->getActiveSheet()->setCellValue($ultima_columna . $renglon, $cli_total);
$total += $cli_total;
$renglon++;
}
}
//.........这里部分代码省略.........