从datagrid导出到excel dateformat问题 [英] export from datagrid to excel dateformat issue

查看:86
本文介绍了从datagrid导出到excel dateformat问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在wpf中获得了一个数据网格。我在这个数据网格中有一个datepicker模板列。



这个日期选择器的格式我设置为YYYY / MM / YY。但是当我将datagrid导出到excel时。



它会显示像dd / mm / yyyy。我有什么人知道如何在我出口时保留出口价格



或从数据网格复制到exp在wpf中。



谢谢

解决方案

如果运气好的话,请在datagrid中将数据类型作为字符串而不是datetime。当您复制任何日期或从datagrid导出包含日期的数据时,Excel会显示系统日期时间的格式,因此我认为这不是问题,因为客户端会为系统设置适合他的日期时间格式。

hi all,

I got a datagrid in wpf. I got a datepicker templatecolumn in this datagrid.

The format for this datepicker I set to YYYY/MM/YY. But when I export the datagrid to excel.

It will shows like dd/mm/yyyy. Does anyone know how can I keep the frommat when I export

or copy from datagrid to excel in wpf.

Thanks

解决方案

Try datatype as string instead of datetime in datagrid if any luck. Excel pics the format of your system datetime when you copy any date or export data containing date from datagrid so as far as i think its not an issue as client would have set date-time format for system which is well suited for him.


这篇关于从datagrid导出到excel dateformat问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆