如何在没有安装办公室的情况下以编程方式创建,阅读,编写excel? [英] How can I programmatically create, read, write an excel without having office installed?

查看:98
本文介绍了如何在没有安装办公室的情况下以编程方式创建,阅读,编写excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很困惑,所有的bazillion方式来读/写/创建excel文件的地狱。 VSTO,OLEDB等,但他们都认为必须安装办公室。



这是我的情况:我需要开发一个应用程序,它将采用excel文件作为输入,做一些计算并创建一个新的excel文件,这将基本上是第一个excel文件的修改。所有的限制,运行它的机器可能没有安装办公室。 (不要问为什么...)



我需要支持所有的 excel格式。唯一的救恩就是格式电子表格本身很简单。只是一堆列和价值观,没什么好想的。不幸的是,最终用户没有CSV可能甚至不知道什么是CSV文件。

解决方案

在HTML表格格式中编写excel :

 < html> 
< body>
< table>
< tr>
< td style =background-color:#acc3ff> Cell1< / td>
< td style =font-weight:bold> Cell2< / td>
< / tr>
< / table>
< / body>
< / html>

,并为您的文件提供一个xls扩展名。 Excel将自动转换


I'm confused as hell with all the bazillion ways to read/write/create excel files. VSTO, OLEDB, etc, but they all seem to have the requirement that office must be installed.

Here is my situation: I need to develop an app which will take an excel file as input, do some calculations and create a new excel file which will basically be a modification of the first excel file. All with the constraint that the machine that runs this may not have office installed. (Don't ask why...)

I need to support all excel formats. The only saving grace is that the formats spreadsheets themselves are really simple. Just a bunch of columns and values, nothing fancy. And unfortunately no CSV as the end user might not even know what a CSV file is.

解决方案

write your excel in HTML table format:

<html>
<body>
  <table>
    <tr>
    <td style="background-color:#acc3ff">Cell1</td>
    <td style="font-weight:bold">Cell2</td>
    </tr>
  </table>
</body>
</html>

and give your file an xls extension. Excel will convert it automatically

这篇关于如何在没有安装办公室的情况下以编程方式创建,阅读,编写excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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