Problem with Page Orientation of Excel Workbook While Streaming MIME Content

Discussion in 'ASP General' started by Yelena Kaplun, Jan 14, 2005.

  1. 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
     
    Yelena Kaplun, Jan 14, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Excel _WorkBook vs. Excel.Workbook

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,697
    Steve C. Orr [MVP, MCSD]
    Sep 29, 2004
  2. Yelena Kaplun
    Replies:
    1
    Views:
    5,229
    Yelena Kaplun
    Jan 19, 2005
  3. MS News
    Replies:
    0
    Views:
    785
    MS News
    Jun 27, 2005
  4. Lize
    Replies:
    1
    Views:
    395
    Tom Kaminski [MVP]
    Jul 7, 2004
  5. Problem with excel workbook

    , Jul 26, 2007, in forum: Perl Misc
    Replies:
    1
    Views:
    163
    Lambik
    Jul 26, 2007
Loading...

Share This Page