Solved

Formatting Excel via XML, possible... how?

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

860 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