读取服务器上未安装Office的Excel文件 [英] Read Excel file without office installed on server

查看:269
本文介绍了读取服务器上未安装Office的Excel文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我创建了一个从excel读取数据并存储在列表中的Web应用程序。但现在问题是客户端服务器没有在服务器上安装MS OFFICE 2010,他们不想安装MS OFFICE 2010.如何在服务器上安装MS OFFICE 2010的情况下从.xlsx文件中读取excel数据?

Hi
I have created web application that reads data from excel and store in a list. But now the thing is that client server doesnot have MS OFFICE 2010 installed on the server and they dont want to install MS OFFICE 2010. How can i read excel data from .xlsx file without MS OFFICE 2010 installed on the server?

推荐答案

如果excel文件总是XLSX文件,那么你可以使用OpenXML组件。

我最近使用过http://epplus.codeplex.com/ [ ^ ],我发现它非常容易使用。



这只是一个dll,你可以打包你的网站和使用。在网站上,虽然您需要仔细阅读许可。
If the excel files are always going to be XLSX file then you could use an OpenXML componenet.
I recently used http://epplus.codeplex.com/[^] which I found to be very easy to use.

This is just a dll that you can package up with your website and use. On the site, although you need to read the licensing carefully.


只需将* .xlsx文件重命名为* .zip文件并打开它;)

i猜这个档案包含* .xml文件。
just rename the *.xlsx file to a *.zip file and open it ;)
i guess this archive contains *.xml files.


直到Office 2003,Microsoft Office文档遵循二进制格式,你需要Office Interop与Microsoft Office文档交谈。但是,这在Office 2007中发生了巨大变化。 Microsoft遵循Open XML格式(当然,XML标签特定于Microsoft文档),但您可以将所有Excel,Word,Powerpoint文件作为纯XML文档读取,如下所示:



Till Office 2003, Microsoft office documents where following the Binary format and you would need Office Interop to talk to Microsoft Office documents. But, this dramatically changed in Office 2007 forward. Microsoft follows the Open XML formats (of course, the XML tags are bit specific to Microsoft documents), but you can read all Excel, Word, Powerpoint files as plain XML documents like shown below:

<?xml version="1.0"?>
<w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
    <w:body>
        <w:p>
        </w:p>
    </w:body>
</w:wordDocument>







您需要做的就是使用Packaging界面打开这些文件,这是.NET framework 2.0的一部分,并开始使用Open XML标准阅读XML部件。



请参阅 http:// msdn .microsoft.com / zh-cn / library / bb456488.aspx [




All you need to do is open these files using the Packaging interface which is part of .NET framework 2.0 and start reading the XML Parts using the Open XML standards.

Please refer to http://msdn.microsoft.com/en-us/library/bb456488.aspx[

Getting started with the Open XML SDK 2.5 for Office

]对此进行快速启动。

] to have a jump start on this.


这篇关于读取服务器上未安装Office的Excel文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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