0

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]
Gil
  • 184
  • 1
  • 3
  • 15
  • 1
    Do you mean custom headers & footers? Those that you can edit in the dialog box "Page setup"? If it's so, those options are saved in the same XLS sub-file as the sheet contents. – Skrol29 Aug 27 '12 at 22:48
  • yes, i think... the header which is repeated in all pages.. on Excel 2007 when you go to insert->header&footer.. what sub-file? – Gil Aug 28 '12 at 09:12
  • The header is included in the sheet. Nevertheless, it is only a text contents. So maybe doing a MergeBlock() is not accurate. can we have the snippet of the header part of your template ? – Skrol29 Sep 04 '12 at 22:50
  • is that enough? im still having the same problem – Gil Sep 11 '12 at 17:19
  • well, i have this method working on other doc, but this one is still not working... – Gil Sep 12 '12 at 17:43
  • The error says that item `courseaction_ref` is not found in the data, i.e. `$header`. You can check this with a `var_export($header); exit;`. Anyway, in order to suppress the error message, you can replace `[header.courseaction_ref]` with `[header.courseaction_ref;noerr]`. – Skrol29 Sep 12 '12 at 21:05
  • i fix this :) ill post soon :) – Gil Sep 17 '12 at 15:29

1 Answers1

1

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 :)

Gil
  • 184
  • 1
  • 3
  • 15