gridlines toggled off when importing html table

L

livefree75

Math,

Just figured this out, with your code as an example. In my case, I
was not only trying to retain the gridlines, but also force the group
summary rows above the detail.

All you need from your code below is the following. The part I was
missing was xmlns attributes in the <html> tag. This tells Excel to
read your <xml> directives, rather than creating its own.

<html xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns:x="urn:schemas-microsoft-com:eek:ffice:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html;
charset=windows-1252"> <!-- charset is your choice -->
<!--[if gte mso 9]>
<xml>
<x:ExcelWorkbook>
<x:ExcelWorksheet>
<x:Name>Your sheetname here</x:Name>
<x:WorksheetOptions>
<x:NoSummaryRowsBelowDetail/><!-- this was for my problem -->
<x:DisplayGridlines/><!-- this is for your problem -->
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml>
<![endif]-->
</head>
<body>
<!-- Your data here -->
</body>
</html>



That sort of thing was my first thought - borders, background, etc -
but it's not the case. The tick box for gridlines in the options is
empty when I open the file.- Hide quoted text -

- Show quoted text -

So far, I've managed to reinstate the grid lines by copying in some
lines from an Excel html file, into a basic file that I typed up in
Notepad (see below)

<html xmlns:eek:="urn:schemas-microsoft-com:eek:ffice:eek:ffice"
xmlns:x="urn:schemas-microsoft-com:eek:ffice:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html;
charset=windows-1252">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 11">
<style>
<!--table
@page{}
-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet>
<x:Name>Sheet1</x:Name>
<x:WorksheetOptions><x:panes>
</x:panes></x:WorksheetOptions>
</x:ExcelWorksheet></x:ExcelWorksheets></
x:ExcelWorkbook>
</xml>
<![endif]-->
</head>

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

But if anyone can show me a more succinct way of doing this, I'd be
very grateful. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top