123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723 |
- <?php
- namespace Vtiful\Kernel;
- /**
- * Class Excel
- *
- * @author viest
- *
- * @package Vtiful\Kernel
- */
- class Excel
- {
- const TYPE_STRING = 0x01;
- const TYPE_INT = 0x02;
- const TYPE_DOUBLE = 0x04;
- const TYPE_TIMESTAMP = 0x08;
- const SKIP_NONE = 0x00;
- const SKIP_EMPTY_ROW = 0x01;
- const SKIP_EMPTY_CELLS = 0x02;
- const GRIDLINES_HIDE_ALL = 0;
- const GRIDLINES_SHOW_SCREEN = 1;
- const GRIDLINES_SHOW_PRINT = 2;
- const GRIDLINES_SHOW_ALL = 3;
- /**
- * Excel constructor.
- *
- * @param array $config
- */
- public function __construct(array $config)
- {
- //
- }
- /**
- * File Name
- *
- * @param string $fileName
- * @param string $sheetName
- *
- * @return Excel
- *
- * @author viest
- */
- public function fileName(string $fileName, string $sheetName = 'Sheet1'): self
- {
- return $this;
- }
- /**
- * Const memory model
- *
- * @param string $fileName
- * @param string $sheetName
- *
- * @return Excel
- *
- * @author viest
- */
- public function constMemory(string $fileName, string $sheetName = 'Sheet1'): self
- {
- return $this;
- }
- /**
- * Add a new worksheet to a workbook.
- *
- * The worksheet name must be a valid Excel worksheet name, i.e. it must be
- * less than 32 character and it cannot contain any of the characters:
- *
- * / \ [ ] : * ?
- *
- * In addition, you cannot use the same, case insensitive, `$sheetName` for more
- * than one worksheet.
- *
- * @param string|NULL $sheetName
- *
- * @return Excel
- *
- * @author viest
- */
- public function addSheet(?string $sheetName): self
- {
- return $this;
- }
- /**
- * Checkout worksheet
- *
- * @param string $sheetName
- *
- * @return Excel
- *
- * @author viest
- */
- public function checkoutSheet(string $sheetName): self
- {
- return $this;
- }
- /**
- * Insert data on the first line of the worksheet
- *
- * @param array $header
- *
- * @return Excel
- *
- * @author viest
- */
- public function header(array $header): self
- {
- return $this;
- }
- /**
- * Insert data on the worksheet
- *
- * @param array $data
- *
- * @return Excel
- *
- * @author viest
- */
- public function data(array $data): self
- {
- return $this;
- }
- /**
- * Generate file
- *
- * @return string
- *
- * @author viest
- */
- public function output(): string
- {
- return 'FilePath';
- }
- /**
- * Get file resource
- *
- * @return resource
- *
- * @author viest
- */
- public function getHandle()
- {
- //
- }
- /**
- * Auto filter on the worksheet
- *
- * @param string $range
- *
- * @return Excel
- *
- * @author viest
- */
- public function autoFilter(string $range): self
- {
- return $this;
- }
- /**
- * Insert data on the cell
- *
- * @param int $row
- * @param int $column
- * @param int|string|double $data
- * @param string|null $format
- * @param resource|null $formatHandle
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertText(int $row, int $column, $data, string $format = NULL, $formatHandle = NULL): self
- {
- return $this;
- }
- /**
- * Insert date on the cell
- *
- * @param int $row
- * @param int $column
- * @param int $timestamp
- * @param string|NULL $format
- * @param resource|null $formatHandle
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertDate(int $row, int $column, int $timestamp, string $format = NULL, $formatHandle = NULL): self
- {
- return $this;
- }
- /**
- * Insert chart on the cell
- *
- * @param int $row
- * @param int $column
- * @param resource $chartResource
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertChart(int $row, int $column, $chartResource): self
- {
- return $this;
- }
- /**
- * Insert url on the cell
- *
- * @param int $row
- * @param int $column
- * @param string $url
- * @param resource|null $formatHandle
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertUrl(int $row, int $column, string $url, $formatHandle = NULL): self
- {
- return $this;
- }
- /**
- * Insert image on the cell
- *
- * @param int $row
- * @param int $column
- * @param string $imagePath
- * @param float $width
- * @param float $height
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertImage(int $row, int $column, string $imagePath, float $width = 1, float $height = 1): self
- {
- return $this;
- }
- /**
- * Insert Formula on the cell
- *
- * @param int $row
- * @param int $column
- * @param string $formula
- *
- * @return Excel
- *
- * @author viest
- */
- public function insertFormula(int $row, int $column, string $formula): self
- {
- return $this;
- }
- /**
- * Merge cells
- *
- * @param string $range
- * @param string $data
- *
- * @return Excel
- *
- * @author viest
- */
- public function MergeCells(string $range, string $data): self
- {
- return $this;
- }
- /**
- * Set column cells width or format
- *
- * @param string $range
- * @param float $cellWidth
- * @param resource|null $formatHandle
- *
- * @return Excel
- *
- * @author viest
- */
- public function setColumn(string $range, float $cellWidth, $formatHandle = NULL): self
- {
- return $this;
- }
- /**
- * Set row cells height or format
- *
- * @param string $range
- * @param float $cellHeight
- * @param resource|null $formatHandle
- *
- * @return Excel
- *
- * @author viest
- */
- public function setRow(string $range, float $cellHeight, $formatHandle = NULL): self
- {
- return $this;
- }
- /**
- * Open xlsx file
- *
- * @param string $fileName
- *
- * @return Excel
- *
- * @author viest
- */
- public function openFile(string $fileName): self
- {
- return $this;
- }
- /**
- * Open sheet
- *
- * default open first sheet
- *
- * @param string|NULL $sheetName
- * @param int skipFlag
- *
- * @return Excel
- *
- * @author viest
- */
- public function openSheet(string $sheetName = NULL, int $skipFlag = 0x00): self
- {
- return $this;
- }
- /**
- * Set row cell data type
- *
- * @param array $types
- *
- * @return Excel
- *
- * @author viest
- */
- public function setType(array $types): self
- {
- return $this;
- }
- /**
- * Read values from the sheet
- *
- * @return array
- *
- * @author viest
- */
- public function getSheetData(): array
- {
- return [];
- }
- /**
- * Read values from the sheet
- *
- * @return array
- *
- * @author viest
- */
- public function nextRow(): array
- {
- return [];
- }
- /**
- * Next Cell In Callback
- *
- * @param callable $callback function(int $row, int $cell, string $data)
- * @param string|NULL $sheetName sheet name
- *
- * @author viest
- */
- public function nextCellCallback(callable $callback, string $sheetName = NULL): void
- {
- //
- }
- /**
- * Freeze panes
- *
- * freezePanes(1, 0); // Freeze the first row.
- * freezePanes(0, 1); // Freeze the first column.
- * freezePanes(1, 1); // Freeze first row/column.
- *
- * @param int $row
- * @param int $column
- *
- * @return $this
- *
- * @author viest
- */
- public function freezePanes(int $row, int $column): self
- {
- return $this;
- }
- /**
- * Gridline
- *
- * Display or hide screen and print gridlines using one of the values of
- *
- * \Vtiful\Kernel\Excel::GRIDLINES_HIDE_ALL
- * \Vtiful\Kernel\Excel::GRIDLINES_SHOW_ALL
- * \Vtiful\Kernel\Excel::GRIDLINES_SHOW_PRINT
- * \Vtiful\Kernel\Excel::GRIDLINES_SHOW_SCREEN
- *
- * Excel default is that the screen gridlines are on and the printed worksheet is off.
- *
- * @param int $option
- *
- * @return $this
- *
- * @author viest
- */
- public function gridline(int $option): self
- {
- return $this;
- }
- /**
- * Worksheet zoom
- *
- * Set the worksheet zoom factor in the range 10 <= zoom <= 400:
- *
- * @param int $scale
- *
- * @return $this
- *
- * @author viest
- */
- public function zoom(int $scale): self
- {
- return $this;
- }
- }
- /**
- * Class Format
- *
- * @author viest
- *
- * @package Vtiful\Kernel
- */
- class Format
- {
- const UNDERLINE_SINGLE = 0x00;
- const UNDERLINE_DOUBLE = 0x00;
- const UNDERLINE_SINGLE_ACCOUNTING = 0x00;
- const UNDERLINE_DOUBLE_ACCOUNTING = 0x00;
- const FORMAT_ALIGN_LEFT = 0x00;
- const FORMAT_ALIGN_CENTER = 0x00;
- const FORMAT_ALIGN_RIGHT = 0x00;
- const FORMAT_ALIGN_FILL = 0x00;
- const FORMAT_ALIGN_JUSTIFY = 0x00;
- const FORMAT_ALIGN_CENTER_ACROSS = 0x00;
- const FORMAT_ALIGN_DISTRIBUTED = 0x00;
- const FORMAT_ALIGN_VERTICAL_TOP = 0x00;
- const FORMAT_ALIGN_VERTICAL_BOTTOM = 0x00;
- const FORMAT_ALIGN_VERTICAL_CENTER = 0x00;
- const FORMAT_ALIGN_VERTICAL_JUSTIFY = 0x00;
- const FORMAT_ALIGN_VERTICAL_DISTRIBUTED = 0x00;
- const COLOR_BLACK = 0x00;
- const COLOR_BLUE = 0x00;
- const COLOR_BROWN = 0x00;
- const COLOR_CYAN = 0x00;
- const COLOR_GRAY = 0x00;
- const COLOR_GREEN = 0x00;
- const COLOR_LIME = 0x00;
- const COLOR_MAGENTA = 0x00;
- const COLOR_NAVY = 0x00;
- const COLOR_ORANGE = 0x00;
- const COLOR_PINK = 0x00;
- const COLOR_PURPLE = 0x00;
- const COLOR_RED = 0x00;
- const COLOR_SILVER = 0x00;
- const COLOR_WHITE = 0x00;
- const COLOR_YELLOW = 0x00;
- const PATTERN_NONE = 0x00;
- const PATTERN_SOLID = 0x00;
- const PATTERN_MEDIUM_GRAY = 0x00;
- const PATTERN_DARK_GRAY = 0x00;
- const PATTERN_LIGHT_GRAY = 0x00;
- const PATTERN_DARK_HORIZONTAL = 0x00;
- const PATTERN_DARK_VERTICAL = 0x00;
- const PATTERN_DARK_DOWN = 0x00;
- const PATTERN_DARK_UP = 0x00;
- const PATTERN_DARK_GRID = 0x00;
- const PATTERN_DARK_TRELLIS = 0x00;
- const PATTERN_LIGHT_HORIZONTAL = 0x00;
- const PATTERN_LIGHT_VERTICAL = 0x00;
- const PATTERN_LIGHT_DOWN = 0x00;
- const PATTERN_LIGHT_UP = 0x00;
- const PATTERN_LIGHT_GRID = 0x00;
- const PATTERN_LIGHT_TRELLIS = 0x00;
- const PATTERN_GRAY_125 = 0x00;
- const PATTERN_GRAY_0625 = 0x00;
- const BORDER_THIN = 0x00;
- const BORDER_MEDIUM = 0x00;
- const BORDER_DASHED = 0x00;
- const BORDER_DOTTED = 0x00;
- const BORDER_THICK = 0x00;
- const BORDER_DOUBLE = 0x00;
- const BORDER_HAIR = 0x00;
- const BORDER_MEDIUM_DASHED = 0x00;
- const BORDER_DASH_DOT = 0x00;
- const BORDER_MEDIUM_DASH_DOT = 0x00;
- const BORDER_DASH_DOT_DOT = 0x00;
- const BORDER_MEDIUM_DASH_DOT_DOT = 0x00;
- const BORDER_SLANT_DASH_DOT = 0x00;
- /**
- * Format constructor.
- *
- * @param resource $fileHandle
- */
- public function __construct($fileHandle)
- {
- //
- }
- /**
- * Wrap
- *
- * @return Format
- *
- * @author viest
- */
- public function wrap(): self
- {
- return $this;
- }
- /**
- * Bold
- *
- * @return Format
- *
- * @author viest
- */
- public function bold(): self
- {
- return $this;
- }
- /**
- * Italic
- *
- * @return Format
- *
- * @author viest
- */
- public function italic(): self
- {
- return $this;
- }
- /**
- * Cells border
- *
- * @param int $style const BORDER_***
- *
- * @return Format
- *
- * @author viest
- */
- public function border(int $style): self
- {
- return $this;
- }
- /**
- * Align
- *
- * @param int ...$style const FORMAT_ALIGN_****
- *
- * @return Format
- *
- * @author viest
- */
- public function align(...$style): self
- {
- return $this;
- }
- /**
- * Number format
- *
- * @param string $format
- *
- * #,##0
- *
- * @return Format
- *
- * @author viest
- */
- public function number(string $format): self
- {
- return $this;
- }
- /**
- * Font color
- *
- * @param int $color const COLOR_****
- *
- * @return Format
- *
- * @author viest
- */
- public function fontColor(int $color): self
- {
- return $this;
- }
- /**
- * Font
- *
- * @param string $fontName
- *
- * @return Format
- *
- * @author viest
- */
- public function font(string $fontName): self
- {
- return $this;
- }
- /**
- * Font size
- *
- * @param float $size
- *
- * @return Format
- *
- * @author viest
- */
- public function fontSize(float $size): self
- {
- return $this;
- }
- /**
- * String strikeout
- *
- * @return Format
- *
- * @author viest
- */
- public function strikeout(): self
- {
- return $this;
- }
- /**
- * Underline
- *
- * @param int $style const UNDERLINE_****
- *
- * @return Format
- *
- * @author viest
- */
- public function underline(int $style): self
- {
- return $this;
- }
- /**
- * Cell background
- *
- * @param int $color const COLOR_****
- * @param int $pattern const PATTERN_****
- *
- * @return Format
- *
- * @author viest
- */
- public function background(int $color, int $pattern = self::PATTERN_SOLID): self
- {
- return $this;
- }
- /**
- * Format to resource
- *
- * @return resource
- *
- * @author viest
- */
- public function toResource()
- {
- //
- }
- }
|