devexpress gridview exporttoxls/xlsx无法正常工作

发布于 2025-02-05 18:43:45 字数 759 浏览 4 评论 0原文

我目前正在尝试将GridView1导出到XLS和XLSX文件。我的问题是,导出不起作用。我只是得到一个空文件和以下错误:

“

,我可以找到有关此错误的任何内容。.

我的代码非常基本:

           Case "barXLS"
                fileName = $"C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xls"
                GridView1.ExportToXls(fileName)
            Case "barXLSX"
                fileName = $"C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xlsx"
                GridView1.ExportToXlsx(fileName)

但是我尝试了很多设置,用于gridview和xlsexportoptionsex,但是他们都没有工作。当我尝试打开XLS表格时,我会发现一个错误,说该文件已损坏。

我真的很感谢您的帮助,谢谢!

I´m currently trying to export my GridView1 to an XLS- and XLSX-File. My Problem is, that the export is not working. I just get an empty file and the following error:

Export-Error

And I can´t find anything regarding this error..

My code is pretty basic:

           Case "barXLS"
                fileName = 
quot;C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xls"
                GridView1.ExportToXls(fileName)
            Case "barXLSX"
                fileName = 
quot;C:\Temp\{dt.Year}{dt.Month}{dt.Day}{dt.Second}_Export.xlsx"
                GridView1.ExportToXlsx(fileName)

But I tried a lot of settings for the GridView and for XlsExportOptionsEx but none of them worked. When I try to open the XLS-Sheet I get an error saying that the file is corrupted.

I would really appreciate your help, thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沧笙踏歌 2025-02-12 18:43:45

我在列定义中添加了以下行:

columns(i).UnboundDataType = GetType(<DATATYPE>)

之后,导出按预期工作。

I added the following line to my column-defintions:

columns(i).UnboundDataType = GetType(<DATATYPE>)

After that the export worked as expected.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文