ExportExcel2007
class ExportExcel2007 extends ModeleExports (View source)
Class to build export files with Excel format
Properties
| string | $name | from CommonDocGenerator | |
| string | $version | Dolibarr version of the loaded document |
|
| string | $error | from ModeleExports | |
| string[] | $errors | from CommonDocGenerator | |
| string[] | $warnings | from CommonDocGenerator | |
| protected DoliDB | $db | from CommonDocGenerator | |
| ExtraFields | $extrafieldsCache | from CommonDocGenerator | |
| int | $update_main_doc_field | from CommonDocGenerator | |
| string | $scandir | from CommonDocGenerator | |
| string | $description | from CommonDocGenerator | |
| array{0: float, 1: float} | $format | from CommonDocGenerator | |
| string | $type | from CommonDocGenerator | |
| float | $page_hauteur | from CommonDocGenerator | |
| float | $page_largeur | from CommonDocGenerator | |
| float | $marge_gauche | from CommonDocGenerator | |
| float | $marge_droite | from CommonDocGenerator | |
| float | $marge_haute | from CommonDocGenerator | |
| float | $marge_basse | from CommonDocGenerator | |
| int | $corner_radius | from CommonDocGenerator | |
| int<0, 1> | $option_logo | from CommonDocGenerator | |
| int<0, 1> | $option_tva | from CommonDocGenerator | |
| int<0, 1> | $option_multilang | from CommonDocGenerator | |
| int<0, 1> | $option_freetext | from CommonDocGenerator | |
| int<0, 1> | $option_draft_watermark | from CommonDocGenerator | |
| string | $watermark | from CommonDocGenerator | |
| int<0, 1> | $option_modereg | from CommonDocGenerator | |
| int<0, 1> | $option_condreg | from CommonDocGenerator | |
| int<0, 1> | $option_escompte | from CommonDocGenerator | |
| int<0, 1> | $option_credit_note | from CommonDocGenerator | |
| array<string, float> | $tva | from CommonDocGenerator | |
| array<string, array{amount: float}> | $tva_array | from CommonDocGenerator | |
| array<int, array<string, float>> | $localtax1 | Local tax rates Array[tax_type][tax_rate] |
from CommonDocGenerator |
| array<int, array<string, float>> | $localtax2 | Local tax rates Array[tax_type][tax_rate] |
from CommonDocGenerator |
| int | $tabTitleHeight | from CommonDocGenerator | |
| array{align?: "R"|"C"|"L", padding?: array<float|int>} | $defaultTitlesFieldsStyle | from CommonDocGenerator | |
| array{align?: "R"|"C"|"L", padding?: array<float|int>} | $defaultContentsFieldsStyle | from CommonDocGenerator | |
| Societe | $emetteur | from CommonDocGenerator | |
| array{0: int, 1: int} | $phpmin | from CommonDocGenerator | |
| array<string, array{rank: int, width: float|false, status: bool|int<0, 1>, border-left?: bool, title: array{textkey: string, label?: string, align?: string, padding?: array{0: float, 1: float, 2: float, 3: float}}, content?: array{align?: string, padding?: array{0: float, 1: float, 2: float, 3: float}}}> | $cols | from CommonDocGenerator | |
| array<string, array{page: int, y: float|int}> | $afterColsLinePositions | from CommonDocGenerator | |
| array{fullpath: string} | $result | from CommonDocGenerator | |
| float | $posxlabel | from CommonDocGenerator | |
| float | $posxup | from CommonDocGenerator | |
| float | $posxref | from CommonDocGenerator | |
| float | $posxpicture | from CommonDocGenerator | |
| float | $posxdesc | from CommonDocGenerator | |
| float | $posxqty | from CommonDocGenerator | |
| float | $posxpuht | from CommonDocGenerator | |
| float | $posxtva | from CommonDocGenerator | |
| float|int | $posxtotalht | from CommonDocGenerator | |
| float | $postotalht | from CommonDocGenerator | |
| float | $posxunit | from CommonDocGenerator | |
| float | $posxdiscount | from CommonDocGenerator | |
| float | $posxworkload | from CommonDocGenerator | |
| float | $posxtimespent | from CommonDocGenerator | |
| float | $posxprogress | from CommonDocGenerator | |
| bool | $atleastonephoto | from CommonDocGenerator | |
| int<0, 1> | $atleastoneratenotnull | from CommonDocGenerator | |
| bool|int<0, 1> | $atleastonediscount | from CommonDocGenerator | |
| string | $id | from ModeleExports | |
| array<string, string> | $driverlabel | from ModeleExports | |
| array<string, string> | $driverdesc | from ModeleExports | |
| array<string, string> | $driverversion | from ModeleExports | |
| array<string, string> | $liblabel | from ModeleExports | |
| array<string, string> | $libversion | from ModeleExports | |
| string | $picto | from ModeleExports | |
| array<string, string> | $pictos | from ModeleExports | |
| string | $desc | from ModeleExports | |
| string | $escape | from ModeleExports | |
| string | $enclosure | from ModeleExports | |
| string | $separator | from ModeleExports | |
| int | $col | ||
| int<0, 1> | $disabled | from ModeleExports | |
| string | $label | ||
| string | $extension | ||
| string | $label_lib | ||
| string | $version_lib | ||
| Spreadsheet | $workbook | ||
| void | $worksheet | ||
| array{borders?: array{outline: array{borderStyle: string, color: array{argb: string}}}, font?: array{color: array{argb: string}, bold: bool}, alignment?: array{horizontal: string}} | $styleArray | ||
| int | $row | ||
| string | $file |
Methods
Constructor
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value For example {company_name}, {company_name_alias}
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
Define array with couple substitution key => substitution value
Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are formatted.
Rect pdf
Print a rounded rectangle on the PDF
Get position in PDF after col display
Used for reset afterColsLinePositions var in start of a new pdf draw line loop
Used for to set afterColsLinePositions var in a pdf draw line loop
uasort callback function to Sort columns fields
Prepare Array Column Field
get column content width from column key
get column content X (abscissa) left position from column key
get column position rank from column key
print standard column content
print description column content
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block
display extrafields columns content
Print standard column content
Define Array Column Field for extrafields
Define Array Column Field into $this->cols This method must be implemented by the module that generate the document with its own columns.
Load into memory list of available export format
Output record line into file
getDriverLabel
getDriverDesc
getDriverVersion
getLibLabel
getLibVersion
getDriverExtension
Write header
Output title line into file
Write footer
Close Excel file
getDriverId
getDriverLabel
Clean a cell to respect rules of Excel file cells
Convert a column to letter (1->A, 0->B, 27->AA, ...)
Set cell value and automatically merge if we give an endcell
Set border style
Set font style
Set alignment style (horizontal, left, right, ...)
Reset Style
Make a NxN Block in sheet
Make a 2xN Tab in Sheet
Enable auto sizing for column range
Set a value cell and merging it by giving a starting cell and a length
Details
__construct($db)
Constructor
array<string, float|string>
get_substitutionarray_user(User $user, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, float|string>
getSubstitutionarrayMember(Adherent $member, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_mysoc(Societe $mysoc, Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_thirdparty(Societe $object, Translate $outputlangs, string $array_key = 'company')
Define array with couple substitution key => substitution value For example {company_name}, {company_name_alias}
array<string, mixed>
get_substitutionarray_contact(Contact $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_other(Translate $outputlangs)
Define array with couple substitution key => substitution value
array<string, mixed>
get_substitutionarray_object(CommonObject $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
get_substitutionarray_lines(CommonObjectLine $line, Translate $outputlangs, $linenumber = 0)
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
array<string, mixed>
get_substitutionarray_shipment(Expedition $object, Translate $outputlangs, string $array_key = 'object')
Define array with couple substitution key => substitution value Note that vars into substitutions array are formatted.
array<string, mixed>
get_substitutionarray_each_var_object(CommonObject|float|int|string>|CommonObject $object, Translate $outputlangs, bool|int $recursive = 1)
Define array with couple substitution key => substitution value
array<string, float|string>
fill_substitutionarray_with_extrafields(CommonObject $object, array<string, float|string> $array_to_fill, $extrafields, $array_key, $outputlangs)
Fill array with couple extrafield key => extrafield value Note that vars into substitutions array are formatted.
void
printRect(TCPDI|TCPDF $pdf, float $x, float $y, float $l, float $h, int<-1, 1> $hidetop = 0, int<0, 1> $hidebottom = 0)
Rect pdf
void
printRoundedRect(TCPDF $pdf, float $x, float $y, float $w, float $h, float $r, int<-1, 1> $hidetop = 0, int $hidebottom = 0, string $style = 'D')
Print a rounded rectangle on the PDF
false|array{page: int, y: float|int, col: string}
getMaxAfterColsLinePositionsData()
Get position in PDF after col display
void
resetAfterColsLinePositionsData(float $y, int $pageNumb)
Used for reset afterColsLinePositions var in start of a new pdf draw line loop
void
setAfterColsLinePositionsData(string $colId, float $y, int $pageNumb)
Used for to set afterColsLinePositions var in a pdf draw line loop
columnSort($a, array{rank?: int} $b)
uasort callback function to Sort columns fields
@param array{rank?:int} $a PDF lines array fields configs
prepareArrayColumnField($object, Translate $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
Prepare Array Column Field
@param CommonObject $object common object
float
getColumnContentWidth($colKey)
get column content width from column key
@param string $colKey the column key
float
getColumnContentXStart($colKey)
get column content X (abscissa) left position from column key
@param string $colKey the column key
int
getColumnRank($colKey)
get column position rank from column key
@param string $colKey the column key
insertNewColumnDef($newColKey, array{rank?: int} $defArray, $targetCol = '', $insertAfterTarget = false)
get column position rank from column key
@param string $newColKey the new column key
printStdColumnContent(TCPDI|TCPDF $pdf, $curY, $colKey, $columnText = '')
print standard column content
printColDescContent(TCPDI|TCPDF $pdf, $curY, $colKey, $object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $issupplierline = 0)
print description column content
getExtrafieldContent($object, string $extrafieldKey, $outputlangs = null)
get extrafield content for pdf writeHtmlCell compatibility usage for PDF line columns and object note block
@param CommonObject $object Common object
getExtrafieldsInHtml($object, Translate $outputlangs, $params = array())
display extrafields columns content
@param CommonObject|CommonObjectLine $object line of common object
bool
getColumnStatus($colKey)
get column status from column key
@param string $colKey the column key
float
pdfTabTitles(TCPDI|TCPDF $pdf, float $tab_top, float $tab_height, Translate $outputlangs, int $hidetop = 0)
Print standard column content
defineColumnExtrafield($object, Translate $outputlangs, $hidedetails = 0)
Define Array Column Field for extrafields
@param CommonObject $object common object det
defineColumnField($object, Translate $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0)
Define Array Column Field into $this->cols This method must be implemented by the module that generate the document with its own columns.
@param CommonObject $object Common object
listOfAvailableExportFormat($db, int $maxfilenamelength = 0)
Load into memory list of available export format
@param DoliDB $db Database handler
string
getPictoForKey($key)
Return picto of export driver
@param string $key Key of driver
string
getDriverLabelForKey($key)
Return label of driver export
@param string $key Key of driver
string
getDriverDescForKey($key)
Renvoi le descriptif d'un driver export
@param string $key Key of driver
string
getDriverVersionForKey($key)
Renvoi version d'un driver export
@param string $key Key of driver
string
getLibLabelForKey($key)
Renvoi label of driver lib
@param string $key Key of driver
string
getLibVersionForKey($key)
Return version of driver lib
@param string $key Key of driver
write_record($array_selected_sorted, resource|object $objp, $outputlangs, $array_types)
Output record line into file
@param array<string,string> $array_selected_sorted Array with list of field to export
string
getDriverLabel()
getDriverLabel
string
getDriverDesc()
getDriverDesc
string
getDriverVersion()
getDriverVersion
string
getLibLabel()
getLibLabel
string
getLibVersion()
getLibVersion
string
getDriverExtension()
getDriverExtension
int
open_file($file, Translate $outputlangs)
Open output file
@param string $file File name to generate
int
write_header($outputlangs)
Write header
@param Translate $outputlangs Object lang to translate values
write_title($array_export_fields_label, array<string, string> $array_selected_sorted, $outputlangs, $array_types)
Output title line into file
@param array<string,string> $array_export_fields_label Array with list of label of fields
int
write_footer($outputlangs)
Write footer
@param Translate $outputlangs Output language object
close_file()
Close Excel file
@return int Return integer <0 if KO, >0 if OK
string
getDriverId()
getDriverId
string
getDriverLabelBis()
getDriverLabel
string
excel_clean(string $newvalue)
Clean a cell to respect rules of Excel file cells
string
column2Letter(int $c)
Convert a column to letter (1->A, 0->B, 27->AA, ...)
int
setCellValue(string $val, string $startCell, string $endCell = '')
Set cell value and automatically merge if we give an endcell
int
setBorderStyle(string $thickness, string $color)
Set border style
int
setFontStyle(bool $bold, string $color)
Set font style
int
setAlignmentStyle(string $horizontal)
Set alignment style (horizontal, left, right, ...)
int
resetStyle()
Reset Style
int
setBlock(string $startCell, array<string, array<null|int|float|string>> $TDatas = array(), bool $boldTitle = false)
Make a NxN Block in sheet
int
setBlock2Columns(string $startCell, array<string, null|int|float|string> $TDatas = array(), bool $boldTitle = false)
Make a 2xN Tab in Sheet
int
enableAutosize(string $firstColumn, string $lastColumn)
Enable auto sizing for column range
int|string
setMergeCellValueByLength(string $val, string $startCell, int $length, int $offset = 0)
Set a value cell and merging it by giving a starting cell and a length