I am trying to use Excel::Writer::XLSX. Most things already successfully, but I struggle to get a formula into a cell.
use utf8;
is set
I am trying to set the formula into the cell with the following statement:
$av_obj_excel_worksheet_DATA->write_formula( 'a3', '=_xlfn._xlws.FILTER(gw_col_gwuPMBo,(MONTH(gw_col_DATUM)=1)*(gw_col_gwuPMBo<>0),"_empty")' );
I have the extracted the.xlsx-file (since it is a simple zip-file) and had a look at the relevant xml of the spreadsheet.
The result is:
_xlfn._xlws.FILTER(gw_col_gwuPMBo,(MONTH(gw_col_DATUM)=1)*(gw_col_gwuPMBo&lt;&gt;0),"_empty")
but the result should be, since I created an.xlsx-file manually and had again a look at the relevant xml-file of the relevant spreadsheet:
_xlfn._xlws.FILTER(gw_col_gwuPMBo,(MONTH(gw_col_DATUM)=2)*(gw_col_gwuPMBo<>0),"_empty")
I seems to me some unicode problem.
Unicode is difficult to understand and - I regret - I don't realy do!
Can someone help me what to do to get the correct form of the formula into the.xlsx file (or related.xml-file of the relevant spreadsheet?
Thanks
I already experimented with encode and decode and now found the solution:
$av_tmp_STRING = '=_xlfn._xlws.FILTER(gw_col_gwuPMBo,(MONTH(gw_col_DATUM)=1)*(gw_col_gwuPMBo<>0),"_empty")';
$av_tmp_STRING = decode( 'UTF-8', $av_tmp_STRING );
$av_obj_excel_worksheet_DATA->write_formula( 'a3', $av_tmp_STRING );
the hurdle was that I did not see the result durging debugging the script. But the correct string was written to the.xlsx-file.
Sometimes, by thinking, searching and trying it comes to a positive result.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.