Monday, November 19, 2007

Scaling of Excel export page

After exporting a website into an Excel page it might happen that not the
whole content fits on a print sheet. Therefor a possible solution is the
scaling of the page. This can easily be done with extra header information
in the website like the following:

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office: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>
@page { margin:.90in .70in .70in .70in;
mso-header-margin:.49in;
mso-footer-margin:.49in; }
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:WorksheetOptions>
<x:DefaultColWidth>10</x:DefaultColWidth>
<x:Print>
<x:ValidPrinterInfo/>
<x:PaperSizeIndex>9</x:PaperSizeIndex>
<x:Scale>80</x:Scale>
<x:HorizontalResolution>600</x:HorizontalResolution>
<x:VerticalResolution>600</x:VerticalResolution>
</x:Print>
<x:Selected/>
<x:DoNotDisplayGridlines/>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>

Important is the tag <x:Scale>. Also interesting is the tag
<DoNotDisplayGridlines> which suppresses the table/line borders.

No comments: