What's XLSHTML?

亡梦爱人 提交于 2019-12-22 09:15:33

问题


What's XLSHTML?

I want to generate, as simply as possible, a file which will open in Excel when a user double-clicks it, and which has some minimal styling.

XLS meets my user requirements, but it's not easy to generate. CSV is easy to generate but has no styling. HTML is easy to generate and has styling but won't open in Excel when double-clicked (you can File->Open it but that's not sufficient, and you can save it as .XLS but then the user gets a warning).

I see in the file extension associations on this PC that there's an extension ".xlshtml", a "Microsoft Office Excel HTML Document", which opens in Excel by default. That looks promising. However, I can't figure out what it is. It's not simply HTML (that gives the warning as above, suggesting my plain HTML isn't it). My version of Excel can't save it. MSDN has virtually nothing on it, and Google seems to only turn up pages that list in as a possible filename extension for Excel files.

Does anybody know what these are? Is it just some special form of HTML that Excel likes? Does anybody have a sample I can see?

EDIT: Based on Divo's hint, I found this. It looks like an Office 2000 / 10 feature that let you save HTML with Office's extra native features in XML islands. It looks like a fairly strict format which they deprecated because nobody used it. I'm still looking through the docs I found, but I haven't figured out how to make a file in this format yet.


回答1:


I dont have an example but id bet you there is a corresponding XSD or DTD for it. Perhaps trying makign a dummy Excel doc and save it as that. If it uses a DTD/XSD it should be inline or have a reference to it somewhere.




回答2:


I can create the following file:

<html>
<body>
<table>
    <tr>
        <td>1</td>
        <td>2</td>
    </tr>
    <tr>
        <td>3</td>
        <td>4</td>
    </tr>
</table>        
</body>
</html>

...and then save it with an .xls extension, I can then double-click it and it opens in Excel. I don't get a warning in that case.

Granted, it's unstyled, so you'd have to reverse-engineer MS's proprietary CSS it likes to use when exporting an XLS file as HTML.




回答3:


After saving your HTML as filename.html (extension .html) you can use some basic formatting like: <body><table border="1">



来源:https://stackoverflow.com/questions/2322479/whats-xlshtml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!