ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing to Landscape mode automatically (https://www.excelbanter.com/excel-programming/278963-changing-landscape-mode-automatically.html)

Joe McCormick

Changing to Landscape mode automatically
 
I am trying to use HTML/XML to import an HTML report into Excel 2002.
I am having problems setting up the worksheet so it will print in
landscape mode. I want to use XML since I ultimately want to create
one workbook with several worksheets.

I can get most of my formatting done, but I can't change to landscape.
I think the "mso-page-orientation" should work, but it doesn't. What
is even more confusing is that the report will be landscape if I open
the report in Excel, but it isn't if I have the HTML/XML program open
it.

Here is the HTML/XML code I want to use to read in the HTML report.
This file is saved with an "XLS" extension.

<html xmlns:x="urn:schemas-microsoft-com:office:excel"
<head
<meta http-equiv=Content-Type content="text/html;
charset=windows-1252"
<meta name="Excel Workbook Frameset"
<titleReport Title</title
<xml
<x:ExcelWorkbook
<x:ExcelWorksheets
<x:ExcelWorksheet
<x:NameHTML Report</x:Name
<x:WorksheetSource HRef="h:\test2.html" /
</x:ExcelWorksheet
</x:ExcelWorksheets
</x:ExcelWorkbook
</xml
</head
<body</body
</html


Here is the HTML report I want to import. It's name is test2.html and
is read by the previous file.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"

<head
<meta http-equiv=Content-Type content="text/html;
charset=windows-1252"
<meta name=ProgId content=Excel.Sheet
<meta name=Generator content="Microsoft Excel 10"
<titleOutput</title

<style
<!--table
table
{mso-displayed-decimal-separator:"\.";
mso-displayed-thousand-separator:"\,";}
@page
{margin:.25in .25in .25in .25in;
mso-header-margin:.25in;
mso-footer-margin:.25in;
mso-page-orientation:landscape;
mso-horizontal-page-align:center;
mso-vertical-page-align:center;}
--
</style
<!--[if gte mso 9]<xml
<x:ExcelWorkbook
<x:ExcelWorksheets
<x:ExcelWorksheet
<x:WorksheetOptions
<x:FitToPage/
<x:Print
<x:ValidPrinterInfo/
<x:HorizontalResolution600</x:HorizontalResolution
<x:VerticalResolution600</x:VerticalResolution
</x:Print
<x:Selected/
</x:WorksheetOptions
</x:ExcelWorksheet
</x:ExcelWorksheets
</x:ExcelWorkbook
</xml<![endif]--
</head

<body link="#0066CC" vlink="#003366" class=xl24 leftmargin=8
rightmargin=8

<TABLE cellspacing=1 cellpadding=1 rules=NONE frame=VOID border=0
width=100% bgcolor="#E0E0E0"
<TR
<TD ALIGN=CENTER bgcolor="#E0E0E0" colspan=3<font face="Arial,
Helvetica, Helv" size="5" color="#002288"<b<iTest HTML in Excel -
Worksheet #1</i</b</font</TD
</TR
</TABLE
</font</CENTER
<P
<CENTER
<font face="Arial, Helvetica, Helv" size="3" color="#002288"
<TABLE cellspacing=1 cellpadding=7 rules=GROUPS frame=BOX border=1
bgcolor="#F0F0F0" bordercolor="#000000"
<thead
<TR
<TD ALIGN=CENTER bgcolor="#B0B0B0"<font size="4"
color="#0033AA"<bObs</b</font</TD
<TD ALIGN=CENTER bgcolor="#B0B0B0"<font size="4"
color="#0033AA"<bCountry</b</font</TD
<TD ALIGN=LEFT bgcolor="#B0B0B0"<font size="4"
color="#0033AA"<bCity</b</font</TD
</TR
</thead
<tbody
<TR
<TD ALIGN=RIGHT bgcolor="#B0B0B0"<font size="3"
color="#0033AA"1</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3"
color="#000000"Australia</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3"
color="#000000"Sydney</font</TD
</TR
<TR
<TD ALIGN=RIGHT bgcolor="#B0B0B0"<font size="3"
color="#0033AA"2</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3" color="#000000"New
Zealand</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3"
color="#000000"Queenstown</font</TD
</TR
<TR
<TD ALIGN=RIGHT bgcolor="#B0B0B0"<font size="3"
color="#0033AA"3</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3"
color="#000000"United States</font</TD
<TD ALIGN=LEFT bgcolor="#D3D3D3"<font size="3"
color="#000000"Denver</font</TD
</TR
</tbody
</TABLE

</body

</html

Can anybody tell my why it won't go to landscape when I use the
HTML/XML program? Or can anybody suggest an alternative to getting
landscape to work?

Thanks for your help.
Joe McCormick


All times are GMT +1. The time now is 06:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com