转换为日期格式显示#VALUE!在Excel rdlc报告中

时间:2022-08-04 08:24:29

I am trying to generate excel file from an RDLC report where a column in the report table converts a string value to DateTime like below

我试图从RDLC报告生成excel文件,其中报表中的列将字符串值转换为DateTime,如下所示

=IIF(Fields!WeldDate.Value is nothing, nothing, Format(CDate(Fields!WeldDate.Value).ToString("dd/MM/yyyy")))

if the WeldDate is an empty string then Excel data shows #VALUE!. how can I fix this?

如果WeldDate是空字符串,则Excel数据显示#VALUE!。我怎样才能解决这个问题?

P.S: I have also tried below as well.

P.S:我也在下面尝试过。

=IIF(Fields!WeldDate.Value is "", "", Format(CDate(Fields!WeldDate.Value).ToString("dd/MM/yyyy")))

1 个解决方案

#1


0  

Try this:

尝试这个:

=IIf(Len(Fields!WeldDate.Value) > 0, Format(CDate(Fields!WeldDate.Value), "dd/MM/yyyy"), "")

Or check this out, this seems to be a very similar issue:
Formatting null time in RDLC report

或者检查一下,这似乎是一个非常类似的问题:在RDLC报告中格式化空时间

#1


0  

Try this:

尝试这个:

=IIf(Len(Fields!WeldDate.Value) > 0, Format(CDate(Fields!WeldDate.Value), "dd/MM/yyyy"), "")

Or check this out, this seems to be a very similar issue:
Formatting null time in RDLC report

或者检查一下,这似乎是一个非常类似的问题:在RDLC报告中格式化空时间