是否可以将 HTML 文档转换为具有多个工作表/选项卡的 Excel?
我知道我们可以通过管道发送常规 html 文件,并让浏览器将它们作为 Excel 文档打开(您可以通过更改 http 标头和文件名来做到这一点,然后 excel 进行转换)。但是,是否可以在 Excel 中显示带有两个工作表/选项卡的 HTML 文档?
这是我认为可能有效的方法,但没有完全完成工作:
<html>
<body>
<table>
....
</table>
<hr class='pageBreak' /> <= I thought perhaps this would divide stuff up
<table>
....
</table>
<body>
</html>
是否有工作表选项卡或某种命名空间我可以添加到 html 以创建多个工作表?
编辑只是好奇其他人是否有任何想法...:-/
(我正在使用 Ruby,所以如果您知道一个可以将 HTML 标签转换为某种 Excel 工作表对象的库,这也可能有效)
I know we can send regular html files through the tubes and have the browser open them as Excel documents (you do that by changing http headers and the file name, then excel does the conversion). BUT, is it possible to get an HTML document show up in Excel with two Worksheets/Tabs?
Here's what I thought might work, but didn't quite get the job done:
<html>
<body>
<table>
....
</table>
<hr class='pageBreak' /> <= I thought perhaps this would divide stuff up
<table>
....
</table>
<body>
</html>
Is there a worksheet tab or some kind of namespace I could ADD to html in order to create multiple worksheets?
EDIT Just curious if anyone else has any ideas... :-/
(I'm using Ruby, so if you know of a library that will convert HTML tags to an Excel worksheet object of some sort, that might work too)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用 Ruby POI 生成 OLE 文档,例如 Excel 电子表格 ( http://poi.apache.org/poi -ruby.html )。
如果您还需要处理导入 .xls 文件( http:// raa.ruby-lang.org/project/parseexcel/ )。
Try Ruby POI for generating OLE documents like Excel spreadsheets ( http://poi.apache.org/poi-ruby.html ).
The ExcelParser gem is wonderful if you need to handle importing .xls files as well ( http://raa.ruby-lang.org/project/parseexcel/ ).
您需要使用 MHTML 来执行多个选项卡。
您可以将工作簿信息(包括定义每个选项卡以及将显示在选项卡上的标题)和第一个选项卡数据放入 HTML 文件中。
但要指定第一个选项卡之外的每个选项卡的内容,您必须使用 mhtml 规范并在每个表格之间放置一个分隔符。
这将使您开始:Multipart HTML
我找不到教程引导新手完成整个过程。
You need to use MHTML to do multiple tabs.
You can put the workbook information (which includes defining each of your tabs and the title that will appear on the tab) and the first tab data into an HTML file.
But to specify the content for each tab beyond the first, you have to use the mhtml spec and put a separator in between each table.
This will get you started on:Multipart HTML
I have not been able to find a tutorial to walk novices through the process.