如果没有安装excel,有没有办法打开和读取excel文件? [英] Is there any way to open and read a excel file if excel is not installed ?

查看:134
本文介绍了如果没有安装excel,有没有办法打开和读取excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开一个excel文件并在我的机器上没有安装excel时读取它。

解决方案

你可以打开任何文件而不需要程序创建它已安装:

  byte  [] data = File.ReadAllBytes(pathToFile); 

将在大多数情况下执行此操作。

问题在于理解它并显示数据。



想一想:a网站只会发布一个HTML流:您可以阅读并找出网站的外观 - 或者您可以将该HTML提供给浏览器应用程序,它将为您完成。后者更快更简单! :笑:



与Excel相同:您可以阅读该文件,但除非您的软件理解Excel数据格式(并且已经存在大量的数据格式)年)你不能轻易对数据做任何事情。您需要安装Excel,或使用可以读取Excel数据的库以便使用该信息。 Google可以帮助您找到合适的图书馆 - 我不知道您要做什么或者您的优先级是什么,所以最好自己开始搜索。


这篇文章 [ ^ ]应该让你没有需要在目标计算机上安装Excel。


您可以在C#中安装Microsoft Excel时读写Excel文档:

这些是一些开源的您可以使用的工具:



http://epplus.codeplex.com/ [ ^ ]

https://closedxml.codeplex.com/ [ ^ ]

https://npoi.codeplex.com/ [ ^ ]

i want to open a excel file and read it when excel is not installed on my machine.

解决方案

You can "open" any file without the program that created it installed:

byte[] data = File.ReadAllBytes(pathToFile);

will do it for most situations.
The problem is in understanding it, and displaying data.

Think about it: a website just emits a stream of HTML: which you can read and work out what the website looks like - or you can feed that HTML into a browser application and it will do it for you. The latter is a lot quicker and simpler! :laugh:

It's the same with Excel: you can read the file, but unless your software understands Excel data format (and there have been a number of them over the years) you can't easily do anything with the data. You need to install Excel, or use a library which can read Excel data in order to use the information. Google can help you find an appropriate library - I have no idea what you are trying to do or what your priorities are, so it's best if you start searching yourself.


This article[^] should get you going without the need to install Excel on the target computer.


You can read and write Excel documents without Microsoft Excel installed in C#:
These are some of the open source tools you can use:

http://epplus.codeplex.com/[^]
https://closedxml.codeplex.com/[^]
https://npoi.codeplex.com/[^]


这篇关于如果没有安装excel,有没有办法打开和读取excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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