【亚洲必赢76net的主页】phpExcel使用方法介绍_php技巧_脚本之家

下载地址: 下边是总计的几个使用方法
include ‘PHPExcel.php’; include ‘PHPExcel/Writer/Excel二零零六.php’;
//只怕include ‘PHPExcel/Writer/Excel5.php’; 用于输出.xls的 创建二个excel
$objPHPExcel = new PHPExcel(卡塔尔(قطر‎; 保存excel—2007格式 $objWriter = new
PHPExcel_Writer_Excel2007; //或者$objWriter = new
PHPExcel_Writer_Excel5; 非2007格式 $objWriter->save;
直接出口到浏览器 $objWriter = new PHPExcel_Writer_Excel5; header;
header; 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;
——————————————————————————————————————– 设置excel的属性: 创制人
$objPHPExcel->getProperties(卡塔尔->setCreator; 最终校正人
$objPHPExcel->getProperties(卡塔尔->setLastModifiedBy; 标题$objPHPExcel->getProperties(卡塔尔国->setTitle(“Office 二零零六 XLSX Test
Document”卡塔尔; 标题 $objPHPExcel->getProperties(卡塔尔(قطر‎->setSubject(“Office
二零零七 XLSX Test Document”卡塔尔国; 描述
$objPHPExcel->getProperties(State of Qatar->setDescription(“Test document for
Office 2006 XLSX, generated using PHP classes.”卡塔尔(قطر‎; 关键字
$objPHPExcel->getProperties(State of Qatar->setKeywords(“office 贰零零柒 openxml
php”卡塔尔; 类别 $objPHPExcel->getProperties(卡塔尔->setCategory;
——————————————————————————————————————– 安装当前的sheet
$objPHPExcel->setActiveSheetIndex; 设置sheet的name
$objPHPExcel->getActiveSheet; 设置单元格的值
$objPHPExcel->getActiveSheet(卡塔尔(قطر‎->setCellValue;
$objPHPExcel->getActiveSheet(卡塔尔国->setCellValue;
$objPHPExcel->getActiveSheet(卡塔尔(قطر‎->setCellValue;
$objPHPExcel->getActiveSheet(卡塔尔(قطر‎->setCellValue;
$objPHPExcel->getActiveSheet(卡塔尔国->setCellValue; 合併单元格
$objPHPExcel->getActiveSheet(卡塔尔(قطر‎->mergeCells; 抽离单元格
$objPHPExcel->getActiveSheet(卡塔尔(قطر‎->unmergeCells; 保养cell
$objPHPExcel->getActiveSheet->setSheet; // Needs to be set to true
in order to enable any worksheet protection!
$objPHPExcel->getActiveSheet(State of Qatar->protectCells; 设置格式 // Set cell
number formats echo date . ” Set cell number formatsn”;
$objPHPExcel->getActiveSheet->getNumberFormat(卡塔尔->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE);
$objPHPExcel->getActiveSheet()->duplicateStyle(
$objPHPExcel->getActiveSheet, ‘E5:E13′ ); 设置宽width // Set column
widths
$objPHPExcel->getActiveSheet()->getColumnDimension->setAutoSize;
$objPHPExcel->getActiveSheet()->getColumnDimension; 设置font
$objPHPExcel->getActiveSheet->getFont;
$objPHPExcel->getActiveSheet->getFont;
$objPHPExcel->getActiveSheet->getFont;
$objPHPExcel->getActiveSheet->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
$objPHPExcel->getActiveSheet->getFont->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
$objPHPExcel->getActiveSheet->getFont->setARGB(PHPExcel_Style_Color::COLOR_WHITE);
$objPHPExcel->getActiveSheet->getFont;
$objPHPExcel->getActiveSheet->getFont; 设置align
$objPHPExcel->getActiveSheet->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
$objPHPExcel->getActiveSheet->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY卡塔尔(قطر‎;
//垂直居中
$objPHPExcel->getActiveSheet->getAlignment(卡塔尔(قطر‎->setVertical(PHPExcel_Style_Alignment::VERTICAL_CENTER);
设置column的border
$objPHPExcel->getActiveSheet->getBorders->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet->getBorders->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet->getBorders->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet->getBorders->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN);
$objPHPExcel->getActiveSheet->getBorders->setBorderStyle(PHPExcel_Style_Border::BORDER_THIN卡塔尔;
设置border的color
$objPHPExcel->getActiveSheet->getBorders->getColor(卡塔尔(قطر‎->setA帕杰罗GB;
$objPHPExcel->getActiveSheet->getBorders->getColor(卡塔尔->setA逍客GB;
$objPHPExcel->getActiveSheet->getBorders->getColor(卡塔尔->setAPRADOGB;
$objPHPExcel->getActiveSheet->getBorders->getColor(卡塔尔(قطر‎->setAENCOREGB;
$objPHPExcel->getActiveSheet->getBorders->getColor(State of Qatar->setA汉兰达GB;
$objPHPExcel->getActiveSheet->getBorders->getColor(卡塔尔->setAXC90GB;
设置填充颜色
$objPHPExcel->getActiveSheet->getFill(卡塔尔->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet->getFill->setARGB;
$objPHPExcel->getActiveSheet->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID);
$objPHPExcel->getActiveSheet->getFill->setARGB; 加图片
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName; $objDrawing->setDescription;
$objDrawing->setPath(‘./images/officelogo.jpg’);
$objDrawing->setHeight;
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet;
$objDrawing = new PHPExcel_Worksheet_Drawing(卡塔尔国;
$objDrawing->setName; $objDrawing->setDescription;
$objDrawing->setPath; $objDrawing->setCoordinates;
$objDrawing->setOffsetX; $objDrawing->setRotation;
$objDrawing->getShadow; $objDrawing->getShadow;
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet;
在暗中同意sheet后,创造一个worksheet echo date . ” Create new Worksheet
objectn”; $objPHPExcel->createSheet(State of Qatar; $objWriter =
PHPExcel_IOFactory::createWriter; $objWriter-save;

发表评论

电子邮件地址不会被公开。 必填项已用*标注