ExporterOds
extends Exporter
in package
Export to Ods
Table of Contents
Constants
- VERSION = 0.87
- UNITS = 'pt'
- XML_HEADER = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
Properties
- $borderTypes : array<string, string>
- $defColor : string
- $defaultStyle : array<string, mixed>
- $fileName : string
- $sheets : array<string|int, Sheet>
- $styles : array<string, mixed>
Methods
- __construct() : mixed
- Set output file name
- addSheet() : void
- Insert sheet, throws error if name exist
- addStyle() : void
- Insert new content style
- compile() : string
- Generate Ods file
- convertSize() : float
- Convert between different measure systems
- download() : void
- Create download content
- getSheets() : array<string|int, Sheet>
- Return array of Sheet
- getVersion() : string
- Return version
- insertSheet() : Sheet
- Create new data sheet, if name already exist rename
- setDefault() : void
- Set default style
- xmlEntities() : string
- Convert XML entities
- checkUniqueName() : string
- Check if chosen name is unique - if not change it
- createTemp() : string
- Create a temporary file in the temporary
- prepareBorder() : array<string, mixed>
- Convert border settings
- fileManifest() : string
- Return ODS manifest file content
- fileMeta() : string
- Return ODS meta file content
- fileMetaInf() : string
- manifest:version="1.2" - buggy for MSO2007
- fileMime() : string
- Return ODS mime type
- fileSheet() : string
- fileStyles() : string
- getBorderStyle() : string
- getCell() : string
- Get table cell
- getCellValue() : string
- Get table cell value
- getStyleElm() : string
- reformatFormula() : string
Constants
VERSION
public
float
VERSION
= 0.87
UNITS
protected
string
UNITS
= 'pt'
XML_HEADER
protected
string
XML_HEADER
= "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
Properties
$borderTypes
public
static array<string, string>
$borderTypes
= ['left' => 'LEFT', 'right' => 'RIGHT', 'top' => 'TOP', 'bottom' => 'BOTTOM']
$defColor
public
static string
$defColor
= '#000000'
$defaultStyle
protected
array<string, mixed>
$defaultStyle
= []
$fileName
protected
string
$fileName
$sheets
protected
array<string|int, Sheet>
$sheets
= []
$styles
protected
array<string, mixed>
$styles
= []
Methods
__construct()
Set output file name
public
__construct(string $fileName) : mixed
Parameters
- $fileName : string
Tags
addSheet()
Insert sheet, throws error if name exist
public
addSheet(Sheet $sheet) : void
Parameters
- $sheet : Sheet
Tags
addStyle()
Insert new content style
public
addStyle(string $mark[, array<string, mixed> $font = [] ][, array<string, mixed> $cell = [] ][, int|null $height = null ]) : void
Parameters
- $mark : string
- $font : array<string, mixed> = []
- $cell : array<string, mixed> = []
- $height : int|null = null
Tags
compile()
Generate Ods file
public
compile() : string
Tags
Return values
stringconvertSize()
Convert between different measure systems
public
static convertSize(string|float $num[, string $def = 'pt' ][, string|null $out = null ]) : float
Parameters
- $num : string|float
-
Value
- $def : string = 'pt'
-
Measure unit
- $out : string|null = null
-
Measure unit
Tags
Return values
floatdownload()
Create download content
public
download() : void
getSheets()
Return array of Sheet
public
getSheets() : array<string|int, Sheet>
Return values
array<string|int, Sheet>getVersion()
Return version
public
getVersion() : string
Return values
stringinsertSheet()
Create new data sheet, if name already exist rename
public
insertSheet([string $name = 'List' ]) : Sheet
Parameters
- $name : string = 'List'
Return values
SheetsetDefault()
Set default style
public
setDefault([array<string, mixed> $font = [] ][, array<string, mixed> $cell = [] ][, int|null $height = null ]) : void
Parameters
- $font : array<string, mixed> = []
- $cell : array<string, mixed> = []
- $height : int|null = null
xmlEntities()
Convert XML entities
public
static xmlEntities(string|float|int|null $val) : string
Parameters
- $val : string|float|int|null
Return values
stringcheckUniqueName()
Check if chosen name is unique - if not change it
protected
checkUniqueName(string $newName[, int $i = 0 ]) : string
Parameters
- $newName : string
- $i : int = 0
Return values
stringcreateTemp()
Create a temporary file in the temporary
protected
createTemp() : string
Tags
Return values
stringprepareBorder()
Convert border settings
protected
prepareBorder(array<string, mixed> $cell) : array<string, mixed>
Parameters
- $cell : array<string, mixed>
Return values
array<string, mixed>fileManifest()
Return ODS manifest file content
private
fileManifest(string $contentFile) : string
Parameters
- $contentFile : string
Return values
stringfileMeta()
Return ODS meta file content
private
fileMeta() : string
Return values
stringfileMetaInf()
manifest:version="1.2" - buggy for MSO2007
private
fileMetaInf(string $contentFile) : string
Parameters
- $contentFile : string
Return values
stringfileMime()
Return ODS mime type
private
fileMime() : string
Return values
stringfileSheet()
private
fileSheet() : string
Tags
Return values
stringfileStyles()
private
fileStyles() : string
Return values
stringgetBorderStyle()
private
getBorderStyle(array<string, mixed> $style[, string|null $side = null ]) : string
Parameters
- $style : array<string, mixed>
- $side : string|null = null
Return values
stringgetCell()
Get table cell
private
getCell(array<string, mixed>|string|float|int|null $col, int $num, int $j, string|null $class, array<int, array<int, int>> &$skipPlan) : string
Parameters
- $col : array<string, mixed>|string|float|int|null
- $num : int
- $j : int
- $class : string|null
- $skipPlan : array<int, array<int, int>>
Return values
stringgetCellValue()
Get table cell value
private
getCellValue(string|float|int $val[, string|null $class = null ][, array<string, mixed>|null $col = null ]) : string
Parameters
- $val : string|float|int
- $class : string|null = null
- $col : array<string, mixed>|null = null
Return values
stringgetStyleElm()
private
getStyleElm(array<string, mixed> $style) : string
Parameters
- $style : array<string, mixed>
Return values
stringreformatFormula()
private
reformatFormula(string $formula) : string
Parameters
- $formula : string