本文整理汇总了PHP中PHPExcel_Worksheet_Drawing类的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Worksheet_Drawing类的具体用法?PHP PHPExcel_Worksheet_Drawing怎么用?PHP PHPExcel_Worksheet_Drawing使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PHPExcel_Worksheet_Drawing类的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");
}
}
}
}
示例2: PHPExcel_Worksheet_Drawing
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./fotos/temporal/PREDIO PORTON DE ACCESO SECUNDARIA.JPG');
$objDrawing->setCoordinates('L98');
$objDrawing->setOffsetY(1);
$objDrawing->setOffsetX(1);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./fotos/temporal/PREDIO OTROS.JPG');
$objDrawing->setCoordinates('C113');
$objDrawing->setOffsetY(1);
$objDrawing->setOffsetX(1);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Logo');
$objDrawing->setDescription('Logo');
$objDrawing->setPath('./fotos/temporal/PREDIO OTROS2.JPG');
$objDrawing->setCoordinates('L113');
$objDrawing->setOffsetY(1);
$objDrawing->setOffsetX(1);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
//===================================================================================================
$nombre_sitio_2g = $_POST['nombre_sitio_2g'];
//$tipo_sitio = $_POST['tipo_sitio'];
//$nombre_sitio_3g = $_POST['nombre_sitio_3g'];
//$propiedad = $_POST['propiedad'];
//$direccion = $_POST['direccion'];
$id2g = $_POST['id2g'];
//$ubicacion = $_POST['ubicacion'];
示例3: while
// Other lines
while ($vo_result->nextHit()) {
$vs_column = reset($va_a_to_z);
$va_supercol_a_to_z = range('A', 'Z');
$vs_supercol = '';
// default to automatic row height. works pretty well in Excel but not so much in LibreOffice/OOo :-(
$o_sheet->getRowDimension($vn_line)->setRowHeight(-1);
foreach ($va_display_list as $vn_placement_id => $va_info) {
if (strpos($va_info['bundle_name'], 'ca_object_representations.media') !== false && $va_info['settings']['display_mode'] == 'media') {
$vs_version = str_replace("ca_object_representations.media.", "", $va_info['bundle_name']);
$va_info = $vo_result->getMediaInfo('ca_object_representations.media', $vs_version);
if ($va_info['MIMETYPE'] == 'image/jpeg') {
// don't try to insert anything non-jpeg into an Excel file
if (is_file($vs_path = $vo_result->getMediaPath('ca_object_representations.media', $vs_version))) {
$image = "image" . $vs_supercol . $vs_column . $vn_line;
$drawing = new PHPExcel_Worksheet_Drawing();
$drawing->setName($image);
$drawing->setDescription($image);
$drawing->setPath($vs_path);
$drawing->setCoordinates($vs_supercol . $vs_column . $vn_line);
$drawing->setWorksheet($o_sheet);
$drawing->setOffsetX(10);
$drawing->setOffsetY(10);
}
$vn_width = floor(intval($va_info['PROPERTIES']['width']) * $vn_ratio_pixels_to_excel_width);
$vn_height = floor(intval($va_info['PROPERTIES']['height']) * $vn_ratio_pixels_to_excel_height);
// set the calculated withs for the current row and column,
// but make sure we don't make either smaller than they already are
if ($vn_width > $o_sheet->getColumnDimension($vs_supercol . $vs_column)->getWidth()) {
$o_sheet->getColumnDimension($vs_supercol . $vs_column)->setWidth($vn_width);
}
示例4: load
//.........这里部分代码省略.........
}
// ----: Make sure drawings and graph are loaded differently!
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");
$drawings = array();
foreach ($relsWorksheet->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
$drawings[(string) $ele["Id"]] = self::dir_add("$dir/$fileWorksheet", $ele["Target"]);
}
}
if ($xmlSheet->drawing && !$this->_readDataOnly) {
foreach ($xmlSheet->drawing as $drawing) {
$fileDrawing = $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "id")];
$relsDrawing = simplexml_load_string($this->_getFromZipArchive($zip, dirname($fileDrawing) . "/_rels/" . basename($fileDrawing) . ".rels") ); //~ http://schemas.openxmlformats.org/package/2006/relationships");
$images = array();
if ($relsDrawing && $relsDrawing->Relationship) {
foreach ($relsDrawing->Relationship as $ele) {
if ($ele["Type"] == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
$images[(string) $ele["Id"]] = self::dir_add($fileDrawing, $ele["Target"]);
}
}
}
$xmlDrawing = simplexml_load_string($this->_getFromZipArchive($zip, $fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
if ($xmlDrawing->oneCellAnchor) {
foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
if ($oneCellAnchor->pic->blipFill) {
$blip = $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
$objDrawing = new PHPExcel_Worksheet_Drawing;
$objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "name"));
$objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), "descr"));
$objDrawing->setPath("zip://$pFilename#" . $images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships"), "embed")], false);
$objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col) . ($oneCellAnchor->from->row + 1));
$objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
$objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
$objDrawing->setResizeProportional(false);
$objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cx")));
$objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes(), "cy")));
if ($xfrm) {
$objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes(), "rot")));
}
if ($outerShdw) {
$shadow = $objDrawing->getShadow();
$shadow->setVisible(true);
$shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "blurRad")));
$shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), "dist")));
$shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes(), "dir")));
$shadow->setAlignment((string) self::array_item($outerShdw->attributes(), "algn"));
$shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), "val"));
$shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), "val") / 1000);
}
$objDrawing->setWorksheet($docSheet);
}
}
}
if ($xmlDrawing->twoCellAnchor) {
foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
if ($twoCellAnchor->pic->blipFill) {
$blip = $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
$xfrm = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
$outerShdw = $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
示例5: 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);
}
示例6: 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);
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: getTeaserImage
private function getTeaserImage(Teasers $teaser)
{
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName($teaser->title);
$path = Yii::app()->params->imageBasePath . DIRECTORY_SEPARATOR . $teaser->picture;
if (!file_exists($path)) {
$path = $path = Yii::app()->params->imageBasePath . DIRECTORY_SEPARATOR . 'notfound.png';
}
$objDrawing->setPath($path);
$objDrawing->setWidthAndHeight(95, 95);
$objDrawing->setOffsetX(10);
$objDrawing->setOffsetY(2);
return $objDrawing;
}
示例11: 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);
}
示例12: 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);
}
示例13: _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;
}
示例14: addLogo
/**
* Добавляет лого на страницу
*
* @param PHPExcel_Worksheet $activeSheet
* @param string|null $rightColumn
*/
protected function addLogo(PHPExcel_Worksheet $activeSheet, $rightColumn = null)
{
$logo_path = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . 'htdocs/images' . DIRECTORY_SEPARATOR . 'logo2.png';
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setWorksheet($activeSheet);
$objDrawing->setName("Лого");
$objDrawing->setPath($logo_path);
$objDrawing->setCoordinates('A1');
$objDrawing->setWidthAndHeight(308.3, 75.90000000000001);
if (null === $rightColumn) {
$rightColumn = $activeSheet->getHighestDataColumn();
}
$activeSheet->mergeCells('A5:' . $rightColumn . '5');
$activeSheet->setCellValue('A5', $this->title);
$activeSheet->getStyle('A5')->applyFromArray(array('font' => array('color' => array('rgb' => '376091'), 'bold' => true), 'alignment' => array('indent' => 10)));
$activeSheet->getStyle('A1:' . $rightColumn . '6')->applyFromArray(array('borders' => array('allborders' => array('style' => PHPExcel_Style_Border::BORDER_NONE)), 'fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FFFFFF'))));
$activeSheet->getStyle('A6:' . $rightColumn . '6')->applyFromArray(array('borders' => array('bottom' => array('style' => PHPExcel_Style_Border::BORDER_MEDIUM, 'color' => array('rgb' => '316194')))));
}
示例15: date
//echo date('H:i:s') , " Unprotect a cell" , EOL;
//$objPHPExcel->getActiveSheet()->getStyle('B1')->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
// Add a hyperlink to the sheet
/*echo date('H:i:s') , " Add a hyperlink to the sheet" , EOL;
$objPHPExcel->getActiveSheet()->setCellValue('E26', 'www.phpexcel.net');
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setUrl('http://www.phpexcel.net');
$objPHPExcel->getActiveSheet()->getCell('E26')->getHyperlink()->setTooltip('Navigate to website');
$objPHPExcel->getActiveSheet()->getStyle('E26')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet()->setCellValue('E27', 'Terms and conditions');
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setUrl("sheet://'Terms and conditions'!A1");
$objPHPExcel->getActiveSheet()->getCell('E27')->getHyperlink()->setTooltip('Review terms and conditions');
$objPHPExcel->getActiveSheet()->getStyle('E27')->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);*/
// 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/nextel2.jpg');
$objDrawing->setHeight(50);
$objDrawing->setCoordinates('C3');
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
// Add a drawing to the worksheet
/*echo date('H:i:s') , " Add a drawing to the worksheet" , EOL;
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Paid');
$objDrawing->setDescription('Paid');
$objDrawing->setPath('./images/paid.png');
$objDrawing->setCoordinates('B15');
$objDrawing->setOffsetX(110);
$objDrawing->setRotation(25);