By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,301 Members | 1,999 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,301 IT Pros & Developers. It's quick & easy.

Problem with Page Orientation of Excel Workbook While Streaming MIME Content

P: n/a
Hi,
I'm trying to customize print settings while streaming HTML content into
Excel. I'm using ASP.NET 1.1 and Excel 2003.
While some printer settings like Margins are working correctly, I cannot
change the Page Orientation to Landscape: mso-page-orientation:landscape;.
I tried to produce the Excel Page, save it as HTML, open in text editor and
then copy and paste Excel generated settings. But it did not help.
If anybody resolved this problem before please respond. Your reply is
greatly appreciated.
I'm setting content type as following:
Response.Clear()

Response.Charset = ""

Response.ContentType = "application/vnd.ms-excel"

Response.AddHeader("Content-Disposition", "attachment;
filename=CampaignReports.xls")

And then using <style> and XML tags to change the settings:

<style>

<!--table

{mso-displayed-decimal-separator:"\.";

mso-displayed-thousand-separator:"\,";}

@page

{margin:1.0in .5in 1.0in .5in;

mso-header-margin:.5in;

mso-footer-margin:.5in;

mso-page-orientation:landscape;}

tr

{mso-height-source:auto;}

col

{mso-width-source:auto;}

br

{mso-data-placement:same-cell;}

-->

</style>

<!--[if gte mso 9]><xml>

<x:ExcelWorkbook>

<x:ExcelWorksheets>

<x:ExcelWorksheet>

<x:Name>CampaignReports 1 </x:Name>

<x:WorksheetOptions>

<x:Print>

<x:ValidPrinterInfo/>

<x:Scale>75</x:Scale>

<x:HorizontalResolution>1200</x:HorizontalResolution>

<x:VerticalResolution>1200</x:VerticalResolution>

</x:Print>

<x:Selected/>

<x:DoNotDisplayGridlines/>

<x:ProtectContents>False</x:ProtectContents>

<x:ProtectObjects>False</x:ProtectObjects>

<x:ProtectScenarios>False</x:ProtectScenarios>

</x:WorksheetOptions>

</x:ExcelWorksheet>

</x:ExcelWorksheets>

<x:WindowHeight>8700</x:WindowHeight>

<x:WindowWidth>15195</x:WindowWidth>

<x:WindowTopX>0</x:WindowTopX>

<x:WindowTopY>120</x:WindowTopY>

<x:ProtectStructure>False</x:ProtectStructure>

<x:ProtectWindows>False</x:ProtectWindows>

</x:ExcelWorkbook>

</xml><![endif]-->

Thanks,

Yelena
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Just an additional info to a previous message: print settings are working
fine for classic ASP version, but in ASP.NET page only margins are changed.
The Landscape and Scale remain unchanged.
"Yelena Kaplun" <ye**********@hotmail.com> wrote in message
news:eS****************@TK2MSFTNGP15.phx.gbl...
Hi,
I'm trying to customize print settings while streaming HTML content into
Excel. I'm using ASP.NET 1.1 and Excel 2003.
While some printer settings like Margins are working correctly, I cannot
change the Page Orientation to Landscape: mso-page-orientation:landscape;.
I tried to produce the Excel Page, save it as HTML, open in text editor and then copy and paste Excel generated settings. But it did not help.
If anybody resolved this problem before please respond. Your reply is
greatly appreciated.
I'm setting content type as following:
Response.Clear()

Response.Charset = ""

Response.ContentType = "application/vnd.ms-excel"

Response.AddHeader("Content-Disposition", "attachment;
filename=CampaignReports.xls")

And then using <style> and XML tags to change the settings:

<style>

<!--table

{mso-displayed-decimal-separator:"\.";

mso-displayed-thousand-separator:"\,";}

@page

{margin:1.0in .5in 1.0in .5in;

mso-header-margin:.5in;

mso-footer-margin:.5in;

mso-page-orientation:landscape;}

tr

{mso-height-source:auto;}

col

{mso-width-source:auto;}

br

{mso-data-placement:same-cell;}

-->

</style>

<!--[if gte mso 9]><xml>

<x:ExcelWorkbook>

<x:ExcelWorksheets>

<x:ExcelWorksheet>

<x:Name>CampaignReports 1 </x:Name>

<x:WorksheetOptions>

<x:Print>

<x:ValidPrinterInfo/>

<x:Scale>75</x:Scale>

<x:HorizontalResolution>1200</x:HorizontalResolution>

<x:VerticalResolution>1200</x:VerticalResolution>

</x:Print>

<x:Selected/>

<x:DoNotDisplayGridlines/>

<x:ProtectContents>False</x:ProtectContents>

<x:ProtectObjects>False</x:ProtectObjects>

<x:ProtectScenarios>False</x:ProtectScenarios>

</x:WorksheetOptions>

</x:ExcelWorksheet>

</x:ExcelWorksheets>

<x:WindowHeight>8700</x:WindowHeight>

<x:WindowWidth>15195</x:WindowWidth>

<x:WindowTopX>0</x:WindowTopX>

<x:WindowTopY>120</x:WindowTopY>

<x:ProtectStructure>False</x:ProtectStructure>

<x:ProtectWindows>False</x:ProtectWindows>

</x:ExcelWorkbook>

</xml><![endif]-->

Thanks,

Yelena

Nov 19 '05 #2

P: 1
Just an additional info to a previous message: print settings are working fine for classic ASP version, but in ASP.NET page only margins are changed. The Landscape and Scale remain unchanged.
I am encourtering the same issue. Were you able to discover a soultion?

Thanks,

Jeff
Apr 27 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.