doo6568 2013-04-26 11:06
浏览 15
已采纳

在Excel报表上的正值旁边添加加号

I use this line to formate my excel cell

$objPHPExcel->getActiveSheet()->getStyle('D12')->getNumberFormat()->setFormatCode("0%");

if the value is negative, excel takes care of that and display the value with a negative sign next to it.
like : -12

How can I change my above code so that the value sign will shows up next to value even if the value is positive?

I mean if the value is positive I will see 12, but I want to change my code to be display +12

  • 写回答

1条回答 默认 最新

  • duanqinbi9029 2013-04-26 11:08
    关注

    The format +0;-0;0 works in Excel (Shows + for positive, - for negative, 0 for 0)

    So try this

    setFormatCode("+0;-0;0")
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部