PHP-Xlswriter
  • Why use xlswriter
  • English
    • Install
      • Env requirements
      • PECL (recommend)
      • Mac
      • Alpine
      • Ubuntu
      • Windows
    • Quick start
      • Create file
      • Read file
    • Read file
      • Worksheet list
      • Read file (full amount)
      • Read file (cursor)
      • Ignore blank cells
      • Ignore blank lines
      • Global row read type
      • Cell callback mode read
      • Read file by data type
      • Data type constant
    • Chart
      • Chart type constant
      • Data input
      • Doughnut chart
      • Area chart
      • Histogram chart
      • Bar chart
    • Cell
      • Insert text
      • Insert link
      • Insert formula
      • Insert date
      • Insert local image
      • Automatic filtering
      • Freeze Panes
      • Merge Cells
      • Row cell style
      • Column cell style
    • Memory model
      • Export - Fixed memory mode
    • Worksheet
      • Create worksheet
      • Switch worksheet
      • Gridlines
      • Zoom
      • Hide the current worksheet
      • Set the current worksheet as the first worksheet
    • Style
      • Combination style
      • Gloabl default style
    • Download
    • Style list
      • Italic
      • Align
      • Text deletion (text middle line)
      • Underline
      • Text wrap
      • Text color
      • Text size
      • Bold
      • Cell border
      • Border style constant
      • Background color
      • Color constant
      • Font
      • Number format
    • CSV
      • XLSX to CSV - Normal mode
      • XLSX to CSV - Callback function mode
    • Printed
      • Set print orientation-landscape
      • Set print orientation-portrait
    • Assistant functions
      • Column index transform
      • Get version
      • Get author
  • Project recommendation
  • 中文简体
    • 安装
      • 环境要求
      • PECL(推荐)
      • Mac
      • Ubuntu
      • Alpine
      • Windows
      • Docker多阶构建
    • 快速上手
      • 导出文件
      • 读取文件
      • 手动销毁资源
    • 读取文件
      • 工作表列表
      • 全量读取
      • 游标读取
      • 跳过指定行
      • 忽略空白单元格
      • 忽略空白行
      • 忽略跳过动作常量
      • 设置全局读取类型
      • 单元格回调模式读取
      • 数据类型读取
      • 数据类型常量
    • 图表
      • 图表类型常量
      • 填充数据
      • 圆环图
      • 面积图
      • 直方图
      • 条形图
    • 数据验证
      • 下拉列表
      • 范围约束
      • 大于约束
    • 单元格
      • 插入文字
      • 插入链接
      • 插入公式
      • 插入日期
      • 插入本地图片
      • 自动过滤
      • 冻结单元格
      • 合并单元格
      • 行单元格样式
      • 列单元格样式
    • 内存模式
      • 导出 - 固定内存模式
    • 工作表
      • 创建工作表
      • 切换工作表
      • 检查工作表是否存在
      • 网格线
      • 缩放
      • 隐藏当前工作表
      • 设置当前工作表为第一个工作表
    • 样式
      • 组合样式
      • 全局默认样式
    • 锁定保护
      • 密码保护
      • 解除保护
    • 打印
      • 纸张大小
      • 纸张方向
      • 纸张边距
      • 缩放比例
      • 设置打印方向 - 横向
      • 设置打印方向 - 纵向
    • 下载
    • 样式列表
      • 斜体
      • 对齐
      • 文本删除(文本中间划线)
      • 下划线
      • 文本换行
      • 文本颜色
      • 文本字号
      • 多样式文本
      • 粗体
      • 单元格边框
      • 边框样式常量
      • 背景颜色
      • 颜色常量
      • 字体
      • 数字格式化
    • CSV
      • XLSX转为CSV - 常规模式
      • XLSX转为CSV - 回调模式
    • 辅助函数
      • 列标字符转化
      • 设置当前写入行号
      • 获取当前写入行号
      • 获取扩展版本
      • 查看作者信息
    • 异常列表
      • 异常码列表
    • 常见问题
      • xls文件通过excel转成xlsx格式后无法读取
  • 项目推荐
Powered by GitBook
On this page
  • 函数原型
  • string $range
  • double $width
  • resource $formatHandler
  • 示例

Was this helpful?

  1. 中文简体
  2. 单元格

列单元格样式

setColumn 样式影响范围为整列。

设置 range 参数为 A1:D1,第一反应是设置第一行的前四个单元格样式,但是实际效果确是设置 第一列、第二列、第三列、第四列 整列。

函数原型

setColumn(string $range, double $width [, resource $formatHandler]);

string $range

单元格范围

double $width

单元格宽度

resource $formatHandler

单元格样式

示例

$config = ['path' => './tests'];
$excel  = new \Vtiful\Kernel\Excel($config);

$fileObject = $excel->fileName('tutorial01.xlsx');
$fileHandle = $fileObject->getHandle();

$format    = new \Vtiful\Kernel\Format($fileHandle);
$boldStyle = $format->bold()->toResource();

$fileObject->header(['name', 'age'])
    ->data([['viest', 21]])
    ->setColumn('A:A', 200, $boldStyle)
    ->output();
Previous行单元格样式Next内存模式

Last updated 4 years ago

Was this helpful?