The following are summarized several ways to use PHP class phpExcel
Create an excel
$objPHPExcel = new PHPExcel( ; Format
$objWriter->save("xxx.xlsx");Output directly to the browser
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
header( "Pragma: public");
header("Cache-Control:must-revalidate, post-check=0, pre-check=0");
header(”Content-Type:application/force-download”);header(”Content-Type:application/vnd.ms-execl”);
header(”Content-Type:application/octet-stream ");
header("Content-Type:application/download");;
header('Content-Disposition:attachment;filename="resume.xls"');
header("Content- Transfer-Encoding:binary”);
$objWriter->save('php://output');
PHP class phpExcel sets excel attributes:
Creator
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
Last modified by
$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw" );
title
title
Description
Keywords
Categories
PHP class phpExcel sets the current sheet
setting The name of the sheet
Set the value of the cell
$objPHPExcel->getActiveSheet()->setCellValue('A2′, 12);
$objPHPExcel->getActiveSheet()->setCellValue(' A3′, true);
$objPHPExcel->getActiveSheet()-> ;setCellValue('B8′, '=MIN(B2:C5)');
Merge cells
$objPHPExcel->getActiveSheet()->mergeCells('A18:E22′);
PHP class phpExcel separate cells
Protect cell
$objPHPExcel->getActiveSheet()->protectCells( 'A3:E13′, 'PHPExcel');
// Set cell number formats
echo date('H:i:s') . ” Set cell number formatsn”; > ;duplicateStyle( $objPHPExcel->getActiveSheet()->getStyle('E4′), 'E5:E13′ );
// Set column widths
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setAutoSize(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth (12);
设置font
$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(’E1′)->getFont()->getColor()->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
$objPHPExcel->getActiveSheet()->getStyle(’D13′)->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getStyle(’E13′)->getFont()->setBold(true);
PHP类phpExcel设置align
$objPHPExcel->getActiveSheet()->getStyle(’D11′)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet()->getStyle(’D12′)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet()->getStyle(’D13′)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet()->getStyle(’A18′)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
//垂直居中
$objPHPExcel->getActiveSheet()->getStyle(’A18′)->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
PHP类phpExcel设置column的border
$objPHPExcel->getActiveSheet()->getStyle(’A4′)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle(’B4′)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle(’C4′)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle(’D4′)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet()->getStyle(’E4′)->getBorders()->getTop()->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
设置border的color
$objPHPExcel->getActiveSheet()->getStyle(’D13′)->getBorders()->getLeft()->getColor()->setARGB(’FF993300′);
$objPHPExcel->getActiveSheet()->getStyle(’D13′)->getBorders()->getTop()->getColor()->setARGB(’FF993300′);
$objPHPExcel->getActiveSheet()->getStyle(’D13′)->getBorders()->getBottom()->getColor()->setARGB(’FF993300′);
$objPHPExcel->getActiveSheet()->getStyle(’E13′)->getBorders()->getTop()->getColor()->setARGB(’FF993300′);
$objPHPExcel->getActiveSheet()->getStyle(’E13′)->getBorders()->getBottom()->getColor()->setARGB(’FF993300′);
$objPHPExcel->getActiveSheet()->getStyle(’E13′)->getBorders()->getRight()->getColor()->setARGB(’FF993300′);
PHP类phpExcel设置填充颜色
$objPHPExcel->getActiveSheet()->getStyle(’A1′)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle(’A1′)->getFill()->getStartColor()->setARGB(’FF808080′);
$objPHPExcel->getActiveSheet()->getStyle(’B1′)->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet()->getStyle(’B1′)->getFill()->getStartColor()->setARGB(’FF808080′);
加图片
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName(’Logo’);
$objDrawing->setDescription(’Logo’);
$objDrawing->setPath(’./images/officelogo.jpg’);
$objDrawing->setHeight(36);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName(’Paid’);
$objDrawing->setDescription(’Paid’);
$objDrawing->setPath(’./images/paid.png’);
$objDrawing->setCoordinates(’B15′);
$objDrawing->setOffsetX(110);
$objDrawing->setRotation(25);
$objDrawing->getShadow()->setVisible(true);
$objDrawing->getShadow()->setDirection(45);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
PHP类phpExcel在默认sheet后,创建一个worksheet
echo date(’H:i:s’) . ” Create new Worksheet objectn”;
$objPHPExcel->createSheet();
$objWriter = PHPExcel_IOFactory::createWriter($objExcel, 'Excel5');
$objWriter-save('php://output');

Win11系统下如何显示文件后缀?详细解读在Windows11操作系统中,文件后缀是指文件名后面的点及其后面的字符,用来表示文件的类型。在默认情况下,Windows11系统会隐藏文件的后缀,这样在文件资源管理器中只能看到文件的名称而无法直观地了解文件的类型。然而,对于一些用户来说,显示文件后缀是非常必要的,因为它能帮助他们更好地辨识文件类型以及进行相关操

随着互联网的不断发展,人们越来越离不开浏览器。而在浏览器中,大家都会或多或少用到cookie这个东西。然而,很多人并不知道cookie数据在哪个文件夹中,今天就来详细解读一下。首先,我们需要了解cookie是什么。简单来说,cookie是由浏览器存储的一段文本信息,用于保存用户在浏览器中的一些个人设置或者记录用户的历史操作等等。当用户再次打开同一个网站时,c

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

LinuxBashrc是Linux系统中的一个配置文件,用于设置用户的Bash(BourneAgainShell)环境。Bashrc文件存储了用户登录时所需的环境变量、启动脚本等信息,可以定制化用户的Shell环境。在Linux系统中,每个用户都有一个对应的Bashrc文件,位于用户的家目录下的隐藏文件夹中。Bashrc文件的作用主要有以下几点:设置环

链上资产代币化正在成为一个重要的长期趋势,前景巨大。其中,国债RWA正在成为重要的分支。这一板块在2023年实现了近7倍的增长,在2023年年末经历短暂回落后,又迅速重回上升通道。本篇BingVentures研究文章将讨论国债RWA以及整个RWA版块的现状和重要发展趋势。RWA生态现状在当前市场环境中,DeFi收益率相对较低,同时实际利率上升,这促进了代币化国债等RWA类资产的增长。投资者更倾向于稳定、可预测收益的资产,这一趋势在金融市场和加密货币市场之间寻求平衡的投资者中尤为明显。代币化国债等

Java文档解读:System类的exit()方法用法解析,需要具体代码示例System类是Java中的一个重要类,它提供了许多与系统相关的功能和方法。其中,exit()方法是System类中的一个常用方法,用于终止当前正在运行的Java虚拟机。在本文中,我们将对exit()方法的用法进行解析,并给出具体的代码示例。exit()方法的定义如下:public

Java文档解读:Short类的toHexString()方法功能解析在Java编程中,我们经常需要进行数值的转换和处理。Short类是Java中的一个包装类,用于处理short类型的数据。其中,Short类提供了一个toHexString()方法,用于将short类型的数据转换为十六进制形式的字符串。本文将对toHexString()方法的功能进行解析,并

深入了解HTTP状态码100:它代表什么意思?HTTP协议是现代互联网应用中最为常用的协议之一,它定义了浏览器和Web服务器之间进行通信所需的标准规范。在HTTP请求和响应的过程中,服务器会向浏览器返回各种类型的状态码,以反映请求的处理情况。其中,HTTP状态码100是一种特殊的状态码,用来表示"继续"。HTTP状态码由三位数字组成,每个状态码都有特定的含义


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Notepad++7.3.1
Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)
