7interactive/php-office-helper

处理Office文件创建的辅助包

2.0.1 2022-01-24 00:22 UTC

This package is auto-updated.

Last update: 2024-09-24 06:26:34 UTC


README

此包实现了 phpoffice/phpspreadsheet

用法

实现新的文档类,扩展 BaseDocumentBaseExcelDocument,就像在 example 文件夹中一样。

实现新的文档辅助类,它扩展 DocumentHelper 并在其中引入一个新的方法,就像下面一样。

/**
 * Returns filename
 *
 * @param \DateTime $from
 * @param \DateTime $to
 * @return string
 */
public function createExcelSpreadsheetActivityLog(\DateTime $from, \DateTime $to): string
{
    /** @var ExampleSpreadsheet $document */
    $document = $this->documentFactory->createByClassName(ExampleSpreadsheet::class);
    $document->setRange($from, $to);
    return $this->documentFactory->save($document);
}

安装

$ composer require 7interactive/php-office-helper

许可证

MIT