TinyButStrong - the PHP Template Engine
Categories > OpenTBS with ODS >

Merged document is not showing dates with ope=tbs:date. Temporary patch

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Francisco Agut
Date: 2013-11-26
Time: 14:28

Merged document is not showing dates with ope=tbs:date. Temporary patch

Hi,

LibreOffice has added new attribute in its xml structure, "calcext:value-type". If this attribute is not the same of "office:value-type" then no data if showed in cell when open merged document.
Other solution is to drop "calcext:value-type" attribute from xml and file will open correctly.
Example: When calcext:value-type="string" and office:value-type="date"
I have modified tbs_plugin_opentbs.php temporally to solve this issue (version 1.8.1), modifying OpenDoc_ChangeCellType function. Here is the code:

      .......
      .......
        // replace the current string with blanck chars
        $len = $Loc->PosEnd - $Loc->PosBeg + 1;
        $Txt = substr_replace($Txt, str_repeat(' ',$len), $Loc->PosBeg, $len);
     
// ---------------------------------------------- HACK
      $calcext_AttStr = 'calcext:value-type="string"';
      $calcext_pos = strpos($tag, $calcext_AttStr);
      if ($calcext_pos!==false) {
         $calcext_pos = strpos($Txt, $calcext_AttStr, $t0);
         $calcext_AttStr_len = strlen($calcext_AttStr);
         $Txt = substr_replace($Txt, str_repeat(' ',$calcext_AttStr_len), $calcext_pos, $calcext_AttStr_len);
      }
// ---------------------------------------------- END HACK

        // prepare special formating for the value
        $type = $OpeLst[$Ope];
      .......
      .......


I have tested this issue with ods templates generated by LibreOffice 4.1.3.2 (Windows)

Thanks,
F. Agut
By: Skrol29
Date: 2013-12-12
Time: 23:01

Re: Merged document is not showing dates with ope=tbs:date. Temporary patch

Hi Francisco,

Thank you very much for sharing this.
Do you know what attribute "calcext:value-type" is for?
Why don't you simply delete the attribute using
$Txt = str_replace(' calcext:value-type="string"', '', $Txt);
By: Skrol29
Date: 2013-12-13
Time: 02:26

Re: Merged document is not showing dates with ope=tbs:date. Temporary patch

There is beta version that includes the fix for this problem.

http://www.tinybutstrong.com/dl.php?f=tbs_plugin_opentbs_beta.zip&s=3
By: Francisco Agut
Date: 2013-12-18
Time: 13:30

Re: Merged document is not showing dates with ope=tbs:date. Temporary patch

Thank you for this fix !!!
It seems to work.

About the "calcext:value-type" attribute, I have readed this somewhere (well, here: http://en.libreofficeforum.org/node/6876)
"Elements and attributes beginning with calcext: are extensions to the ODF v1.2 specification, made in an interim manner until ODF v1.3 is formalised. The effect of this particular attribute (introduced in the v4.0 series) is described in the related commit (it is part of an attempt to speed up the importing of data by saving on string checking)"
Mentioned commit is this http://cgit.freedesktop.org/libreoffice/core/commit/?id=9fb60c6a7390f782f1878f0e943ba17fd419ebab