Search code examples
xlsxtinybutstrongopentbs

Load a block on xlsx header


is there any way when using openTBS, to send blocks to an .xlsx header? Like we do on word, load the block on header.xml?

Thanks in advance, regards

UPDATE:

yes, i found the header content in /xl/worksheets/sheet1.xml, but still im trying to merge 2 blocks, base and header... im gonna post some code

$base = $this->_getBase();
$TBS->MergeBlock('base', $base);
if ( $this->have_header == 1) {
        if ($info['extension'] == 'docx') {
            $TBS->LoadTemplate('#word/header2.xml', OPENTBS_ALREADY_UTF8);
        } elseif ($info['extension'] == 'xlsx') {
            $TBS->LoadTemplate('#xl/worksheets/sheet1.xml', OPENTBS_ALREADY_UTF8);
        } 
        $header =  $this->_getBase();
        $TBS->MergeBlock('header', $header);
    }

This is working for MS Word part, but on Excel this is giving me errors like

<br /><b>TinyButStrong Error</b> in field &#91;header.courseaction_ref...]: item 'courseaction_ref' is not an existing key in the array. 

UPDATE:

this is what i have on my header..

[header;block=begin] Mapa de Presenças/Faltas
[header.course_code] - [header.course] - Acção nº [header.action_number] - Ref.ª: [header.courseaction_ref] [header;block=end]

Solution

  • Well i created a new method (_getHEADER) on PHP side, ofc..

    private function _getHeader() {
        if (!isset($this->_queries['HEADER'])) {
            return array();
        }
        return $this->_getOne('HEADER');
    }
    

    and when the documente have header ill do this

    $header =  $this->_getHeader();
            $TBS->MergeBlock('header', $header);
    

    and of course, i have 2 sql blocks, base and header :)

    well im not sure if this is the best way, but its working :)