如何在不使用oledb提供程序的情况下将excel文件xlsx读取到网格视图,因为它没有在godaddy服务器上注册? [英] How to read excel file xlsx to a grid view without oledb provider as it's not registered at godaddy server?

查看:106
本文介绍了如何在不使用oledb提供程序的情况下将excel文件xlsx读取到网格视图,因为它没有在godaddy服务器上注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用oledb提供程序的情况下将excel文件xlsx读取到网格视图,因为它没有在godaddy服务器上注册?



或者有没有办法过来' Microsoft.ACE.OLEDB.12.0'提供程序未在godaddy上的本地计算机上注册

解决方案

您可以使用http://msdn.microsoft.com/en-us/library/microsoft。 office.tools.excel(v = vs.110).aspx [ ^ ]



这是Microsoft.Office.Tools。 Excel命名空间



然后你必须阅读工作表并构建一些与gridview数据绑定的东西,逻辑选择是DataTable,因为它也支持列和行以类似的方式。事实上,这就是使用ole提供者会像其他例子那样做的事情,据我所知你不想做的原因,但会有更多隐含的替代做同样的事情

http://nice-tutorials.blogspot.dk/2011/05/ import-excel-data-to-gridview.html [ ^ ]


为您提供多种选择。



1.使用 Open XML [ ^ ]。对于所有资源 - 宣布发布Open XML SDK 2.0 [ ^ ]。

2.其他开源库提到这里 [ ^ ]。


我在需要运行时引擎的GoDaddy托管网站上遇到了问题,即Crystal Reports。

我在服务器上遇到了一个无法在我的应用程序中使用Office.Interop .dll的问题。我发现这种在Excel中构建数据的好方法,没有任何额外的Office .dll。检查此链接,如果适合您,请告诉我。可能会为你编写一些代码,但是一旦你把它弄下来,这是值得的。它也来自MSDN,因此您不必担心第三方问题。



http://msdn.microsoft.com/en-us/library/office/aa140066%28v=office.10%29.aspx [ ^ ]

How to read excel file xlsx to a grid view without oledb provider as it's not registered at godaddy server??

or is there a way to over come 'Microsoft.ACE.OLEDB.12.0' provider which is not registered on the local machine on godaddy

解决方案

You can manipulate the Excel file using http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel(v=vs.110).aspx[^]

which is the Microsoft.Office.Tools.Excel namespace

You'll then have to read the worksheet and construct something that will databind with your gridview, a logical choise would be a DataTable as it also supports columns and rows in a similar way. In fact that is what using an ole provider will do like this other example which as i understand you don't want to do for reasons, but there would be a bit more implicit alternative of doing the same
http://nice-tutorials.blogspot.dk/2011/05/import-excel-data-to-gridview.html[^]


Couple of options for you.

1. Use Open XML[^]. For all resources - Announcing the Release of the Open XML SDK 2.0[^].
2. Other open source library mentioned here[^].


I ran into issues on GoDaddy hosted websites that required runtime engines, i.e. Crystal Reports.
I also ran into an issue on a server that couldn't use the Office.Interop .dll in my application. I found this nice way of building data in Excel without any extra Office .dlls. Check this link out and let me know if that works for you. Probably some more coding for you, but once you get it down, it's worth it. It's also from the MSDN, so you don't have to worry about 3rd Party issues.

http://msdn.microsoft.com/en-us/library/office/aa140066%28v=office.10%29.aspx[^]


这篇关于如何在不使用oledb提供程序的情况下将excel文件xlsx读取到网格视图,因为它没有在godaddy服务器上注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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