<?php
namespace PhpOffice\PhpSpreadsheet\Reader;
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
use PhpOffice\PhpSpreadsheet\Cell\DataType;
use PhpOffice\PhpSpreadsheet\Cell\DataValidation;
use PhpOffice\PhpSpreadsheet\Exception as PhpSpreadsheetException;
use PhpOffice\PhpSpreadsheet\NamedRange;
use PhpOffice\PhpSpreadsheet\Reader\Xls\ConditionalFormatting;
use PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellFont;
use PhpOffice\PhpSpreadsheet\Reader\Xls\Style\FillPattern;
use PhpOffice\PhpSpreadsheet\RichText\RichText;
use PhpOffice\PhpSpreadsheet\Shared\CodePage;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use PhpOffice\PhpSpreadsheet\Shared\Escher;
use PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer;
use PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE;
use PhpOffice\PhpSpreadsheet\Shared\File;
use PhpOffice\PhpSpreadsheet\Shared\OLE;
use PhpOffice\PhpSpreadsheet\Shared\OLERead;
use PhpOffice\PhpSpreadsheet\Shared\StringHelper;
use PhpOffice\PhpSpreadsheet\Shared\Xls as SharedXls;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Style\Alignment;
use PhpOffice\PhpSpreadsheet\Style\Borders;
use PhpOffice\PhpSpreadsheet\Style\Conditional;
use PhpOffice\PhpSpreadsheet\Style\Fill;
use PhpOffice\PhpSpreadsheet\Style\Font;
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
use PhpOffice\PhpSpreadsheet\Style\Protection;
use PhpOffice\PhpSpreadsheet\Style\Style;
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use PhpOffice\PhpSpreadsheet\Worksheet\SheetView;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
// Original file header of ParseXL (used as the base for this class):
// --------------------------------------------------------------------------------
// Adapted from Excel_Spreadsheet_Reader developed by users bizon153,
// trex005, and mmp11 (SourceForge.net)
// https://sourceforge.net/projects/phpexcelreader/
// Primary changes made by canyoncasa (dvc) for ParseXL 1.00 ...
// Modelled moreso after Perl Excel Parse/Write modules
// Added Parse_Excel_Spreadsheet object
// Reads a whole worksheet or tab as row,column array or as
// associated hash of indexed rows and named column fields
// Added variables for worksheet (tab) indexes and names
// Added an object call for loading individual woorksheets
// Changed default indexing defaults to 0 based arrays
// Fixed date/time and percent formats
// Includes patches found at SourceForge...
// unicode patch by nobody
// unpack("d") machine depedency patch by matchy
// boundsheet utf16 patch by bjaenichen
// Renamed functions for shorter names
// General code cleanup and rigor, including <80 column width
// Included a testcase Excel file and PHP example calls
// Code works for PHP 5.x
// Primary changes made by canyoncasa (dvc) for ParseXL 1.10 ...
// http://sourceforge.net/tracker/index.php?func=detail&aid=1466964&group_id=99160&atid=623334
// Decoding of formula conditions, results, and tokens.
// Support for user-defined named cells added as an array "namedcells"
// Patch code for user-defined named cells supports single cells only.
// NOTE: this patch only works for BIFF8 as BIFF5-7 use a different
// external sheet reference structure
class Xls extends BaseReader
{
private const HIGH_ORDER_BIT = 0x80 << 24;
private const FC000000 = 0xFC << 24;
private const FE000000 = 0xFE << 24;
// ParseXL definitions
const XLS_BIFF8 = 0x0600;
const XLS_BIFF7 = 0x0500;
const XLS_WORKBOOKGLOBALS = 0x0005;
const XLS_WORKSHEET = 0x0010;
// record identifiers
const XLS_TYPE_FORMULA = 0x0006;
const XLS_TYPE_EOF = 0x000A;
const XLS_TYPE_PROTECT = 0x0012;
const XLS_TYPE_OBJECTPROTECT = 0x0063;
const XLS_TYPE_SCENPROTECT = 0x00DD;
const XLS_TYPE_PASSWORD = 0x0013;
const XLS_TYPE_HEADER = 0x0014;
const XLS_TYPE_FOOTER = 0x0015;
const XLS_TYPE_EXTERNSHEET = 0x0017;
const XLS_TYPE_DEFINEDNAME = 0x0018;
const XLS_TYPE_VERTICALPAGEBREAKS = 0x001A;
const XLS_TYPE_HORIZONTALPAGEBREAKS = 0x001B;
const XLS_TYPE_NOTE = 0x001C;
const XLS_TYPE_SELECTION = 0x001D;
const XLS_TYPE_DATEMODE = 0x0022;
const XLS_TYPE_EXTERNNAME = 0x0023;
const XLS_TYPE_LEFTMARGIN = 0x0026;
const XLS_TYPE_RIGHTMARGIN = 0x0027;
const XLS_TYPE_TOPMARGIN = 0x0028;
const XLS_TYPE_BOTTOMMARGIN = 0x0029;
const XLS_TYPE_PRINTGRIDLINES = 0x002B;
const XLS_TYPE_FILEPASS = 0x002F;
const XLS_TYPE_FONT = 0x0031;
const XLS_TYPE_CONTINUE = 0x003C;
const XLS_TYPE_PANE = 0x0041;
const XLS_TYPE_CODEPAGE = 0x0042;
const XLS_TYPE_DEFCOLWIDTH = 0x0055;
const XLS_TYPE_OBJ = 0x005D;
const XLS_TYPE_COLINFO = 0x007D;
const XLS_TYPE_IMDATA = 0x007F;
const XLS_TYPE_SHEETPR = 0x0081;
const XLS_TYPE_HCENTER = 0x0083;
const XLS_TYPE_VCENTER = 0x0084;
const XLS_TYPE_SHEET = 0x0085;
const XLS_TYPE_PALETTE = 0x0092;
const XLS_TYPE_SCL = 0x00A0;
const XLS_TYPE_PAGESETUP = 0x00A1;
const XLS_TYPE_MULRK = 0x00BD;
const XLS_TYPE_MULBLANK = 0x00BE;
const XLS_TYPE_DBCELL = 0x00D7;
const XLS_TYPE_XF = 0x00E0;
const XLS_TYPE_MERGEDCELLS = 0x00E5;
const XLS_TYPE_MSODRAWINGGROUP = 0x00EB;
const XLS_TYPE_MSODRAWING = 0x00EC;
const XLS_TYPE_SST = 0x00FC;
const XLS_TYPE_LABELSST = 0x00FD;
const XLS_TYPE_EXTSST = 0x00FF;
const XLS_TYPE_EXTERNALBOOK = 0x01AE;
const XLS_TYPE_DATAVALIDATIONS = 0x01B2;
const XLS_TYPE_TXO = 0x01B6;
const XLS_TYPE_HYPERLINK = 0x01B8;
const XLS_TYPE_DATAVALIDATION = 0x01BE;
const XLS_TYPE_DIMENSION = 0x0200;
const XLS_TYPE_BLANK = 0x0201;
const XLS_TYPE_NUMBER = 0x0203;
const XLS_TYPE_LABEL = 0x0204;
const XLS_TYPE_BOOLERR = 0x0205;
const XLS_TYPE_STRING = 0x0207;
const XLS_TYPE_ROW = 0x0208;
const XLS_TYPE_INDEX = 0x020B;
const XLS_TYPE_ARRAY = 0x0221;
const XLS_TYPE_DEFAULTROWHEIGHT = 0x0225;
const XLS_TYPE_WINDOW2 = 0x023E;
const XLS_TYPE_RK = 0x027E;
const XLS_TYPE_STYLE = 0x0293;
const XLS_TYPE_FORMAT = 0x041E;
const XLS_TYPE_SHAREDFMLA = 0x04BC;
const XLS_TYPE_BOF = 0x0809;
const XLS_TYPE_SHEETPROTECTION = 0x0867;
const XLS_TYPE_RANGEPROTECTION = 0x0868;
const XLS_TYPE_SHEETLAYOUT = 0x0862;
const XLS_TYPE_XFEXT = 0x087D;
const XLS_TYPE_PAGELAYOUTVIEW = 0x088B;
const XLS_TYPE_CFHEADER = 0x01B0;
const XLS_TYPE_CFRULE = 0x01B1;
const XLS_TYPE_UNKNOWN = 0xFFFF;
// Encryption type
const MS_BIFF_CRYPTO_NONE = 0;
const MS_BIFF_CRYPTO_XOR = 1;
const MS_BIFF_CRYPTO_RC4 = 2;
// Size of stream blocks when using RC4 encryption
const REKEY_BLOCK = 0x400;
/**
* Summary Information stream data.
*/
private ?string $summaryInformation = null;
/**
* Extended Summary Information stream data.
*/
private ?string $documentSummaryInformation = null;
/**
* Workbook stream data. (Includes workbook globals substream as well as sheet substreams).
*/
private string $data;
/**
* Size in bytes of $this->data.
*/
private int $dataSize;
/**
* Current position in stream.
*/
private int $pos;
/**
* Workbook to be returned by the reader.
*/
private Spreadsheet $spreadsheet;
/**
* Worksheet that is currently being built by the reader.
*/
private Worksheet $phpSheet;
/**
* BIFF version.
*/
private int $version = 0;
/**
* Codepage set in the Excel file being read. Only important for BIFF5 (Excel 5.0 - Excel 95)
* For BIFF8 (Excel 97 - Excel 2003) this will always have the value 'UTF-16LE'.
*/
private string $codepage = '';
/**
* Shared formats.
*/
private array $formats;
/**
* Shared fonts.
*
* @var F
没有合适的资源?快使用搜索试试~ 我知道了~
PhpSpreadsheet 是一个用纯 PHP 编写的库,提供了一组类,允许您读取和写入各种电子表格文件格式,例如 Excel
共546个文件
php:500个
config:18个
functions:17个
需积分: 0 0 下载量 102 浏览量
2024-05-14
10:20:41
上传
评论
收藏 1.21MB ZIP 举报
温馨提示
PhpSpreadsheet 是一个功能强大的 PHP 库,通过纯 PHP 编写,提供了一组类,使您能够轻松地读取和写入各种电子表格文件格式,包括 Excel。它是 PHPExcel 的继任者,具有更好的性能和更广泛的功能支持。 **功能特点:** 1. **支持多种电子表格格式:** PhpSpreadsheet 支持读取和写入多种电子表格文件格式,包括 Excel (.xls 和 .xlsx)、OpenDocument (.ods)、CSV、HTML 和 PDF 等。 2. **丰富的功能支持:** PhpSpreadsheet 提供了丰富的功能和 API,可以进行单元格操作、样式设置、图表绘制、公式计算、图片插入、数据透视表等操作,满足各种复杂的需求。 3. **跨平台兼容性:** 由于 PhpSpreadsheet 是用纯 PHP 编写的,因此可以在各种平台上运行,包括 Windows、Linux 和 macOS 等,而无需安装额外的扩展或软件。 4. **活跃的社区支持:** PhpSpreadsheet 拥有活跃的社区支持,有大量的文档、教程和示例可供参考,同时也
资源推荐
资源详情
资源评论
收起资源包目录
PhpSpreadsheet 是一个用纯 PHP 编写的库,提供了一组类,允许您读取和写入各种电子表格文件格式,例如 Excel (546个子文件)
config 424B
config 374B
config 354B
config 349B
config 345B
config 337B
config 336B
config 335B
config 334B
config 332B
config 330B
config 318B
config 315B
config 311B
config 307B
config 304B
config 301B
config 298B
phpstan.neon.dist 1KB
.phpcs.xml.dist 892B
functions 14KB
functions 11KB
functions 11KB
functions 11KB
functions 11KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 10KB
functions 9KB
functions 9KB
composer.json 4KB
LICENSE 1KB
CHANGELOG.md 127KB
README.md 4KB
CONTRIBUTING.md 3KB
phpstan-baseline.neon 27B
Xls.php 278KB
Calculation.php 243KB
Xlsx.php 135KB
Worksheet.php 118KB
Worksheet.php 113KB
Chart.php 79KB
Chart.php 77KB
Worksheet.php 69KB
Html.php 66KB
ReferenceHelper.php 57KB
Parser.php 54KB
Spreadsheet.php 44KB
AutoFilter.php 41KB
Html.php 40KB
Workbook.php 40KB
Ods.php 36KB
ConvertUOM.php 35KB
Xls.php 35KB
Xml.php 32KB
JpGraphRendererBase.php 32KB
Properties.php 29KB
Style.php 27KB
Style.php 26KB
Html.php 26KB
PageSetup.php 26KB
Roman.php 26KB
Font.php 26KB
Xlsx.php 25KB
Coordinate.php 24KB
Cell.php 24KB
Font.php 23KB
StringHelper.php 23KB
Drawing.php 22KB
FormulaParser.php 22KB
Gnumeric.php 22KB
Theme.php 21KB
Slk.php 20KB
Csv.php 19KB
ComplexFunctions.php 19KB
Date.php 19KB
Escher.php 19KB
Coupons.php 18KB
OLE.php 17KB
Table.php 17KB
NumberFormat.php 17KB
Rels.php 17KB
Escher.php 16KB
Content.php 16KB
Chart.php 16KB
Styles.php 16KB
Alignment.php 15KB
Root.php 14KB
Rule.php 14KB
Trends.php 14KB
DataSeriesValues.php 14KB
Cells.php 14KB
Color.php 14KB
共 546 条
- 1
- 2
- 3
- 4
- 5
- 6
资源评论
编程资源宝库
- 粉丝: 3068
- 资源: 181
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功