4

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.

8
  • Beware, it's worse HTML than that of FrontPage ;)
    – user76035
    Feb 23, 2010 at 23:11
  • have you tried making a plain, valid HTML file and giving it an extension of .xlshtml?
    – DA.
    Feb 23, 2010 at 23:12
  • DA: Yes (see "It's not simply HTML"). There's apparently something more to it than that.
    – Ken
    Feb 23, 2010 at 23:21
  • 1
    wwosik: I don't care how ugly it is when Excel exports it, if I can generate it myself, and Excel can read it. :-)
    – Ken
    Feb 23, 2010 at 23:22
  • 1
    I think you are referring to the Excel HTML export/import of Excel 2000. Feb 23, 2010 at 23:29

3 Answers 3

0

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.

1
  • What version of Excel do I need? (See: "My version of Excel can't save it")
    – Ken
    Feb 23, 2010 at 23:36
0

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.

1
  • It gives a warning here. Either you're using a different version of Excel, or you have some setting that turns off the warnings -- neither of which I can assume about my users.
    – Ken
    Feb 24, 2010 at 23:17
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.