phpexcel中文手册

创建表格等

https://blog.csdn.net/pengone/article/details/47724423

设置样式等

http://www.thinkphp.cn/topic/53674.html

 

使用本地图片
 
  
$img = new PHPExcel_Worksheet_Drawing();
$imgFile = '/tmp/coupon.png';
list($width, $height) = getimagesize($imgFile);
$img->setPath($imgFile);
$img->setHeight($height);
$img->setWidth($width);
$img->setOffsetX(1);
$img->setOffsetY(1);
$img->setRotation(0);
$img->getShadow()->setVisible(true);
$img->getShadow()->setDirection(50);
$img->setCoordinates('B2'); // 插入到表格的哪个单元格
$img->setWorksheet($excel->getActiveSheet());

// 图片单元格的宽,高
$rowHeight = ceil(3/4*$height) + 5; // 单元格高单位/像素=3/4
$rowWidth = ceil(3/4*$width/6) + 1 = ceil(1/8*$width) + 1 ; // 单元格宽单位/像素=1/8

$excel->getActiveSheet()->getColumnDimension('B')->setWidth($rowWidth);
$excel->getActiveSheet()->getRowDimension(2)->setRowHeight($rowHeight);

 

写入有链接的文本
$excel->getActiveSheet()->getCell('A2')
    ->setValue('web中的php')
    ->getHyperlink()
    ->setUrl('http://baidu.com');

设置单元格宽度,高度
$excel->getActiveSheet()->getColumnDimension('C')->setWidth(50); // C列宽为50
$excel->getActiveSheet()->getRowDimension(13)->setRowHeight(30); // 13行高为30

 



转载于:https://www.cnblogs.com/bandbandme/p/10715653.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值