PHPackages                             dcat-x/dcat-xlswriter-export - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. dcat-x/dcat-xlswriter-export

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

dcat-x/dcat-xlswriter-export
============================

High-performance Excel export extension for Dcat Admin based on xlswriter

v1.2.0(1mo ago)018MITPHPPHP ^8.2CI passing

Since Jan 13Pushed 1mo agoCompare

[ Source](https://github.com/dcat-x/dcat-xlswriter-export)[ Packagist](https://packagist.org/packages/dcat-x/dcat-xlswriter-export)[ Docs](https://github.com/dcat-x/dcat-xlswriter-export)[ GitHub Sponsors](https://github.com/sponsors/myxiaoao)[ RSS](/packages/dcat-x-dcat-xlswriter-export/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (12)Versions (4)Used By (0)

Dcat Xlswriter Export
=====================

[](#dcat-xlswriter-export)

 [![Tests](https://github.com/dcat-x/dcat-xlswriter-export/actions/workflows/tests.yml/badge.svg)](https://github.com/dcat-x/dcat-xlswriter-export/actions) [![Latest Stable Version](https://camo.githubusercontent.com/6113ae0bbc7bc6bc95696dcd1e0386e8949dcb9be6572fc9db31fc5dc7d9ee3a/68747470733a2f2f706f7365722e707567782e6f72672f646361742d782f646361742d786c737772697465722d6578706f72742f762f737461626c65)](https://packagist.org/packages/dcat-x/dcat-xlswriter-export) [![Total Downloads](https://camo.githubusercontent.com/4324da1e1954c7bc0950eddafc6a7df184bfb24dfc358a5b9968e4d528171f02/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646361742d782f646361742d786c737772697465722d6578706f72742e737667)](https://packagist.org/packages/dcat-x/dcat-xlswriter-export) [![PHP Version](https://camo.githubusercontent.com/0200d9ac6d51b0abb49b6541f56a6d05f497b8bdbe7a237a998885ca44245e71/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532307c253230382e332532307c253230382e342d3539613966382e737667)](https://www.php.net/) [![Laravel Version](https://camo.githubusercontent.com/71346fc06a78b89c689a47aa8f09d4994fe607d69946bb9f389a788a5420f511/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31322532307c25323031332d3539613966382e737667)](https://laravel.com/) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

**基于 [xlswriter](https://xlswriter-docs.viest.me/) 的 [Dcat Admin](https://github.com/dcat-x/laravel-admin) 高性能 Excel 导出扩展**

[English](README.en.md) | 简体中文

特性
--

[](#特性)

- 高性能、低内存占用（支持 50 万+ 行数据导出）
- 大数据集分块处理（默认 5000 条/块）
- 自定义样式（字体、颜色、边框、对齐方式）
- 单元格合并支持
- 冻结表头支持
- 列数字格式配置（金额、百分比、千分位等）
- 多种数据源（Query Builder、Collection、Array、Dcat Grid）
- Swoole 兼容
- 生命周期钩子

环境要求
----

[](#环境要求)

依赖版本PHP^8.2（搭配 Laravel 13 时需 ^8.3）Laravel^12.0 || ^13.0Dcat Admin^1.0 || ^2.0xlswriter 扩展\***版本兼容矩阵**

dcat-x/laravel-adminPHPLaravel1.x^8.2^12.02.x^8.3^12.0 || ^13.0安装
--

[](#安装)

### 1. 安装 xlswriter 扩展

[](#1-安装-xlswriter-扩展)

参考官方文档：

```
# Linux
pecl install xlswriter

# 添加到 php.ini
extension=xlswriter.so
```

安装后通过 `php -m | grep xlswriter` 或 `phpinfo()` 验证。

### 2. 安装扩展包

[](#2-安装扩展包)

```
composer require dcat-x/dcat-xlswriter-export
```

快速开始
----

[](#快速开始)

### 1. 创建导出类

[](#1-创建导出类)

```
