Solved

Formatting Excel via XML, possible... how?

Posted on 2003-10-31
4
461 Views
Last Modified: 2009-06-02
Okay, here's the poop...
I'm creating a Excel worksheet through ASP by creating a table and declaring the 'Response.ContentType = "application/vnd.ms-excel"'.. That's cool, it works great and I get a nice looking Excel spreadsheet showing up in my browser.  Now for the tough part...

Is there any way of controlling the printing parameters for this spreadsheet via XML elements.  I've tried 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>
  <title>excelTest</title>
    <meta name="vs_defaultClientScript" content="VBScript">
    <LINK rel="stylesheet" type="text/css" href="http://localhost/PhotoViewer/Styles.css">
    <xml>
      <o:DocumentProperties>
        <o:LastAuthor>Whomever</o:LastAuthor>
        <o:Created>2003-10-31T19:42:50Z</o:Created>
        <o:LastSaved>2003-10-31T19:42:50Z</o:LastSaved>
        <o:Version>9.2812</o:Version>
      </o:DocumentProperties>
      <o:OfficeDocumentSettings>
        <o:DownloadComponents/>
        <o:TargetScreenSize>640x480</o:TargetScreenSize>
        <o:LocationOfComponents HRef="file:\\nt_part\off2kp\msowc.cab"/>
      </o:OfficeDocumentSettings>
      <x:ExcelWorkbook>
        <x:ExcelWorksheets>
          <x:ExcelWorksheet>
            <x:Name>Heavy Trucks</x:Name>
            <x:WorksheetOptions>
              <x:DefaultRowHeight>210</x:DefaultRowHeight>
              <x:FitToPage/>
                <x:Print>
                  <x:FitHeight>99</x:FitHeight>
                  <x:ValidPrinterInfo/>
                  <x:Scale>59</x:Scale>
                  <x:HorizontalResolution>600</x:HorizontalResolution>
                  <x:VerticalResolution>0</x:VerticalResolution>
                </x:Print>
                <x:Selected/>
                <x:Panes>
                  <x:Pane>
                    <x:Number>3</x:Number>
                    <x:RangeSelection>A1:X1</x:RangeSelection>
                  </x:Pane>
                </x:Panes>
                <x:ProtectContents>False</x:ProtectContents>
                <x:ProtectObjects>False</x:ProtectObjects>
                <x:ProtectScenarios>False</x:ProtectScenarios>
              </x:WorksheetOptions>
            </x:ExcelWorksheet>
          </x:ExcelWorksheets>
          <x:WindowHeight>10545</x:WindowHeight>
          <x:WindowWidth>17280</x:WindowWidth>
          <x:WindowTopX>0</x:WindowTopX>
          <x:WindowTopY>1410</x:WindowTopY>
          <x:ProtectStructure>False</x:ProtectStructure>
          <x:ProtectWindows>False</x:ProtectWindows>
        </x:ExcelWorkbook>
      <x:ExcelName>
        <x:Name>Print_Titles</x:Name>
        <x:SheetIndex>1</x:SheetIndex>
        <x:Formula>='Heavy Trucks'!$1:$7</x:Formula>
      </x:ExcelName>
    </xml>

Also, is there anywhere one can look (preferably on the Internet) to find a reference of the different elements available for MS Office apps like Excel?  I picked these up by saving my worksheet as an HTML document and copying and pasting the values into my program.

Thanks in advance.
0
Comment
Question by:jstradtman
  • 2
4 Comments
 
LVL 1

Expert Comment

by:RickAtKnowWare
ID: 10826714
I know I've seen a document on the Microsoft website that list all of the elements.  I specifically remember a description of the FitToPage element along with hundreds of others.  I remember saving a link to the document, but now I can't find it!  Has anyone else seen this?
0
 
LVL 1

Accepted Solution

by:
RickAtKnowWare earned 500 total points
ID: 10829012
I found it.  It is a document that you can download.  The URL is http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffxml/html/ofxml2k.asp00a2662442d9&displaylang=en

There is also a more recent document but when I looked at it, I found that it seemed to be missing a lot of the elements that were in the earlier one.  The URL for that is:
http://www.microsoft.com/downloads/details.aspx?FamilyID=fe118952-3547-420a-a412-00a2662442d9&displaylang=en
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now