以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]时段字段format  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=32505)

--  作者:rpg2813
--  发布时间:2013/5/3 12:23:00
--  [求助]时段字段format

我有10个列,都是时段字段,然后这10个列的列名都有“时间”这两个字符

 

我的做法是

if 列是数字字段 and 列名包含“时间” then

  xxx

endif

原来的老版本汇总模式不支持format时,一切ok,后来嘛就出bug了

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=12&ID=31843&skin=0

现在我把代码注释掉了

但是就像我帖子里说的,3小时,foxtable显示为3,这太不方便了,我想把时段的字段格式化为00:00

代码如下

if e.col.isnumberic andalso e.col.name.contains("时间")=true then   

   if e.row.isnull(e.col.name)=false //有内容

      e.row.text=format(e.row\\3600,"00")&":"&format(e.row/60)mod 60,"00"

   endif

endif

红色部分怎么写?


--  作者:Bin
--  发布时间:2013/5/3 14:10:00
--  
如果只是为显示.更改列标题,不要随便就更改列名.


--  作者:狐狸爸爸
--  发布时间:2013/5/3 14:41:00
--  

看了你那个帖子,其实你可以drawcell对汇总模式下的分组行无效的啊:

 

If e.Row.IsGroup = False  \'如果不是分组行

    原来的DrawCell事件代码

End If


--  作者:rpg2813
--  发布时间:2013/5/3 21:59:00
--  
以下是引用狐狸爸爸在2013-5-3 14:41:00的发言:

看了你那个帖子,其实你可以drawcell对汇总模式下的分组行无效的啊:

 

If e.Row.IsGroup = False  \'如果不是分组行

    原来的DrawCell事件代码

End If

您的方法可行,但是汇总也应该也format呀

另外我有新的问题

我有个表10多列都是日期字段,领导要求今年以前的时间就2012-12-02这样,今年的日期就05-03这样。

(其实也对,因为10列,50行的表,日期有500个,容易花眼)

drawcell里

 

if e.col.isdate

   if e.row.isnull(e.col.name)=false then //有内容

      if e.xxx.date.year=today.year  then 是今年

         e.text=format(e.text,"MM-DD")

      endif

   endif

endif

 

红色部分代码如何写?


--  作者:don
--  发布时间:2013/5/3 22:19:00
--  

if e.col.isdate

   if e.row.isnull(e.col.name)=false then //有内容

      if Cdate(e.Row(e.col.name)).date.year=today.year  then 是今年

         e.text=format( Cdate(e.Row(e.col.name)),"MM-DD")

      endif

   endif

endif


--  作者:rpg2813
--  发布时间:2013/5/4 12:29:00
--  
以下是引用don在2013-5-3 22:19:00的发言:

if e.col.isdate

   if e.row.isnull(e.col.name)=false then //有内容

      if Cdate(e.Row(e.col.name)).date.year=today.year  then 是今年

         e.text=format( Cdate(e.Row(e.col.name)),"MM-DD")

      endif

   endif

endif

一级棒


--  作者:rpg2813
--  发布时间:2013/5/4 12:34:00
--  

但是还是希望列属性有个format选项

 

最好高级一点,里面可以填一些判断代码呀什么的~

如果再可以根据判断设置字体颜色呀,单元格的颜色呀~

我去~~我是不是想多了?


--  作者:rpg2813
--  发布时间:2013/5/5 21:50:00
--  
人工置顶