satthi/phpexcelwrapper
Composer 安装命令:
composer require satthi/phpexcelwrapper
包简介
PhpExcelWrapper
README 文档
README
このプロジェクトはPHPExcelを自分が使いやすいように対応したものになります。
PhpSpreadsheetWrapperをご利用ください。
インストール
composer.json
{
"require": {
"satthi/phpexcelwrapper": "*"
}
}
composer install
使い方(基本)
<?php require('./vendor/autoload.php'); use PhpExcelWrapper\PhpExcelWrapper; class hoge{ public function fuga(){ $PhpExcelWrapper = new PhpExcelWrapper(); //テンプレート使用の場合 //$PhpExcelWrapper = new PhpExcelWrapper('./template.xlsx'); $PhpExcelWrapper->setVal('設定したい値', 3, 1, 0); $PhpExcelWrapper->write('export.xlsx'); } } $hoge = new hoge(); $hoge->fuga();
準備している関数
/** * setVal * 値のセット * @param text $value 値 * @param integer $col 行 一番左は0 * @param integer $row 列 一番上は1 * @param integer $sheetNo シート番号 default 0 * @param integer $refCol 参照セル行 default null * @param integer $refRow 参照セル列 default null * @param integer $refSheet 参照シート default null * @author hagiwara */ $PhpExcelWrapper->setVal('設定したい値', 3, 1, 0); /** * geVal * 値の取得 * @param integer $col 行 一番左は0 * @param integer $row 列 一番上は1 * @param integer $sheetNo シート番号 default 0 * @author hagiwara */ $PhpExcelWrapper->getVal(3, 1, 0); /** * setImage * 画像のセット * @param text $img 画像のファイルパス * @param integer $col 行 * @param integer $row 列 * @param integer $sheetNo シート番号 default 0 * @param integer $height 画像の縦幅 default null * @param integer $width 画像の横幅 default null * @param boolean $proportial 縦横比を維持するか default false * @param integer $offsetx セルから何ピクセルずらすか(X軸) default null * @param integer $offsety セルから何ピクセルずらすか(Y軸) default null * @author hagiwara */ $PhpExcelWrapper->setImage('img/hoge.gif', 1, 1, 0); /** * cellMerge * セルのマージ * @param integer $col1 行 * @param integer $row1 列 * @param integer $col2 行 * @param integer $row2 列 * @param integer $sheetNo シート番号 * @author hagiwara */ $PhpExcelWrapper->cellMerge(0, 1, 0, 3, 0); /** * styleCopy * セルの書式コピー * @param integer $col 行 * @param integer $row 列 * @param integer $sheetNo シート番号 * @param integer $refCol 参照セル行 * @param integer $refRow 参照セル列 * @param integer $refSheet 参照シート * @author hagiwara */ $PhpExcelWrapper->cellMerge(0, 1, 0, 0, 1, 1); /** * setStyle * 書式のセット(まとめて) * @param integer $col 行 * @param integer $row 列 * @param integer $sheetNo シート番号 * @param array $style スタイル情報 * @author hagiwara */ $style = [ //フォント名 'font' => 'HGP行書体', /* //underline パラメータリスト 'double' => PHPExcel_Style_Font::UNDERLINE_DOUBLE 'doubleaccounting' => PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING 'none' => PHPExcel_Style_Font::UNDERLINE_NONE 'single' => PHPExcel_Style_Font::UNDERLINE_SINGLE 'singleaccounting' => PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING */ 'underline' => 'single', 'bold' => true, 'italic' => true, 'strikethrough' => true, //ARGB 'color' => 'FFFF0000', 'size' => 40, /* //alignh パラメータリスト 'general' => PHPExcel_Style_Alignment::HORIZONTAL_GENERAL, 'center' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'left' => PHPExcel_Style_Alignment::HORIZONTAL_LEFT, 'right' => PHPExcel_Style_Alignment::HORIZONTAL_RIGHT, 'justify' => PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY, 'countinuous' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS, */ 'alignh' => 'justify', /* //alignv パラメータリスト 'bottom' => PHPExcel_Style_Alignment::VERTICAL_BOTTOM, 'center' => PHPExcel_Style_Alignment::VERTICAL_CENTER, 'justify' => PHPExcel_Style_Alignment::VERTICAL_JUSTIFY, 'top' => PHPExcel_Style_Alignment::VERTICAL_TOP, */ 'alignv' => 'bottom', /* //罫線の位置 'left' => null, 'right' => null, 'top' => null, 'bottom' => null, 'diagonal' => null, 'all_borders' => null, 'outline' => null, 'inside' => null, 'vertical' => null, 'horizontal' => null, //罫線の種類 'none' => PHPExcel_Style_Border::BORDER_NONE, 'thin' => PHPExcel_Style_Border::BORDER_THIN, 'medium' => PHPExcel_Style_Border::BORDER_MEDIUM, 'dashed' => PHPExcel_Style_Border::BORDER_DASHED, 'dotted' => PHPExcel_Style_Border::BORDER_DOTTED, 'thick' => PHPExcel_Style_Border::BORDER_THICK, 'double' => PHPExcel_Style_Border::BORDER_DOUBLE, 'hair' => PHPExcel_Style_Border::BORDER_HAIR, 'mediumdashed' => PHPExcel_Style_Border::BORDER_MEDIUMDASHED, 'dashdot' => PHPExcel_Style_Border::BORDER_DASHDOT, 'mediumdashdot' => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT, 'dashdotdot' => PHPExcel_Style_Border::BORDER_DASHDOTDOT, 'mediumdashdotdot' => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT, 'slantdashdot' => PHPExcel_Style_Border::BORDER_SLANTDASHDOT, */ 'border' => [ 'top' => [ 'type' => 'mediumdashed', 'color' => 'FF664422' ], 'bottom' => [ 'type' => 'double', 'color' => 'FF224466' ], ], 'bgcolor' => 'FF0000FF', /* //bgpattern パラメータリスト 'linear' => PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR, 'path' => PHPExcel_Style_Fill::FILL_GRADIENT_PATH, 'none' => PHPExcel_Style_Fill::FILL_NONE, 'darkdown' => PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN, 'darkgray' => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY, 'darkgrid' => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID, 'darkhorizontal' => PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL, 'darktrellis' => PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS, 'darkup' => PHPExcel_Style_Fill::FILL_PATTERN_DARKUP, 'darkvertical' => PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL, 'gray0625' => PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625, 'gray125' => PHPExcel_Style_Fill::FILL_PATTERN_GRAY125, 'lightdown' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN, 'lightgray' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY, 'lightgrid' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID, 'lighthorizontal' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL, 'lighttrellis' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS, 'lightup' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP, 'lightvertical' => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL, 'mediumgray' => PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY, 'solid' => PHPExcel_Style_Fill::FILL_SOLID, */ 'bgpattern' => 'lighthorizontal', ]; $PhpExcelWrapper->setStyle(3, 1, 0, $style); /** * createSheet * シートの作成 * @param text $name * @author hagiwara */ $PhpExcelWrapper->createSheet('hoge'); /** * deleteSheet * シートの削除 * @param integer $sheetNo * @author hagiwara */ $PhpExcelWrapper->deleteSheet(4); /** * copySheet * シートのコピー * @param integer $sheetNo * @param integer $position nullの場合は一番後ろ * @param text $name * @author hagiwara */ $PhpExcelWrapper->copySheet(0, null, 'copy sheet'); /** * renameSheet * シート名の変更 * @param integer $sheetNo * @param text $name * @author hagiwara */ $PhpExcelWrapper->renameSheet(0, 'rename'); /** * write * xlsxファイルの書き込み * @param text $file 書き込み先のファイルパス * @author hagiwara */ $PhpExcelWrapper->write('php://output');
## License ##
The MIT Lisence
Copyright (c) 2016 Fusic Co., Ltd. (http://fusic.co.jp)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Author ##
Satoru Hagiwara
satthi/phpexcelwrapper 适用场景与选型建议
satthi/phpexcelwrapper 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.42k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 05 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「PHPExcel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 satthi/phpexcelwrapper 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 satthi/phpexcelwrapper 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 satthi/phpexcelwrapper 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
CakePHP excel generator
Fork of Maatwebsite for reasons of incompatibility with php >= 7.4 --- of Supercharged Excel exports in Laravel
Symfony Bundle to read or write Excel file (including pdf, xlsx, odt), using phpoffice/phpspreadsheet library (replacement of phpoffice/phpexcel, abandonned)
Supercharged Excel exports and imports in Laravel
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
统计信息
- 总下载量: 2.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-05-24