Solved

Formatting Excel via XML, possible... how?

Posted on 2003-10-31
4
463 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

920 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

11 Experts available now in Live!

Get 1:1 Help Now