7interactive/php-office-helper

Helper package for handling creation of Office files

2.0.1 2022-01-24 00:22 UTC

This package is auto-updated.

Last update: 2024-04-24 05:32:45 UTC


README

This package implements phpoffice/phpspreadsheet.

Usage

Implement new document class, extending BaseDocument or BaseExcelDocument, just like in example folder.

Implement new document helper class, which extends DocumentHelper and introduce a new method inside of it, just like below.

/**
 * 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);
}

Installing

$ composer require 7interactive/php-office-helper

License

MIT