且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在没有安装办公室的情况下以编程方式创建,阅读,编写excel?

更新时间:2023-01-15 09:20:37

在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