如何创建一个HTML文件,在Excel中使用多个表查看?

时间:2022-11-19 23:17:12

I would like to know if it is possible to create a single HTML file which (after changing its extension to .xls) when opened with Excel, will parsed to multiple sheets.

我想知道是否有可能创建一个单独的HTML文件(在将其扩展为.xls之后)以Excel打开后,将解析为多个表单。

Little example :

小例子:

I've got a file test.xls with the content :

我有文件测试。xls的内容:

<html>
<body>
<table>
<tr>
 <td>
 1
 </td>
 <td>
 2
 </td>
 <td>
 3
 </td>
 <td>
 =sum(A1:C1)
 </td>

</tr>
</table>
</body>
</html>

When I open this file with Excel I get one Sheet with calculated sum of cells A1 to C1 in A4=6.

当我用Excel打开这个文件时,我得到一张表格,表格中A1到C1单元格在A4=6中计算出来的总和。

I wonder if it is possible to create an HTML file which contains multiple tables which will be parsed as multiple sheets in Excel.

我想知道是否可以创建一个包含多个表的HTML文件,这些表将在Excel中解析为多个表。

Here is the Excel view of this file : 如何创建一个HTML文件,在Excel中使用多个表查看?

这是这个文件的Excel视图:

1 个解决方案

#1


1  

Yes, it is possible.
However keep in mind that you might not have some features/formatting due to the limitations of this format.

是的,这是可能的。但是请记住,由于这种格式的限制,您可能没有一些特性/格式。

You can save an Excel document with several spreadsheets as HTML, and then reverse engineer it to figure out which part you have to change (it is easy to do).

您可以将一个包含多个电子表格的Excel文档保存为HTML,然后对其进行反向工程,以确定需要更改的部分(这很容易做到)。

To save a document with several spreadsheets as html document : File > Save As > Web Page (*.htm, *.html) The drawback of this method is that it will produce several files.

要将包含多个电子表格的文档保存为html文档:文件>保存为> Web页面(*)。这种方法的缺点是它将生成几个文件。

If you want a unique file, use File > Save As > Single File Web Page (*.mht; *.mhl) This will create a unique file (.mht) that you can open with a browser if you want (most browsers do open these files).

如果您想要一个唯一的文件,请使用文件>保存为>单一文件Web页面(*.mht;这将创建一个独特的文件(.mht),如果你想打开浏览器,你可以打开它(大多数浏览器都打开这些文件)。

More details on office.microsoft.com

在office.microsoft.com上的更多细节

EDIT: I did not post any code here since it is very long (excel automatically adds some code into the file) EDIT2: If you're creating a programm to do this, I would recommend that you use already existing libraries, such as excellibrary

编辑:我没有在这里发布任何代码,因为它很长(excel会自动向文件中添加一些代码)

#1


1  

Yes, it is possible.
However keep in mind that you might not have some features/formatting due to the limitations of this format.

是的,这是可能的。但是请记住,由于这种格式的限制,您可能没有一些特性/格式。

You can save an Excel document with several spreadsheets as HTML, and then reverse engineer it to figure out which part you have to change (it is easy to do).

您可以将一个包含多个电子表格的Excel文档保存为HTML,然后对其进行反向工程,以确定需要更改的部分(这很容易做到)。

To save a document with several spreadsheets as html document : File > Save As > Web Page (*.htm, *.html) The drawback of this method is that it will produce several files.

要将包含多个电子表格的文档保存为html文档:文件>保存为> Web页面(*)。这种方法的缺点是它将生成几个文件。

If you want a unique file, use File > Save As > Single File Web Page (*.mht; *.mhl) This will create a unique file (.mht) that you can open with a browser if you want (most browsers do open these files).

如果您想要一个唯一的文件,请使用文件>保存为>单一文件Web页面(*.mht;这将创建一个独特的文件(.mht),如果你想打开浏览器,你可以打开它(大多数浏览器都打开这些文件)。

More details on office.microsoft.com

在office.microsoft.com上的更多细节

EDIT: I did not post any code here since it is very long (excel automatically adds some code into the file) EDIT2: If you're creating a programm to do this, I would recommend that you use already existing libraries, such as excellibrary

编辑:我没有在这里发布任何代码,因为它很长(excel会自动向文件中添加一些代码)