aspose file tools*
The moose likes XML and Related Technologies and the fly likes How to set Page Orientation and Print settings for generated Excel file using xsl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to set Page Orientation and Print settings for generated Excel file using xsl" Watch "How to set Page Orientation and Print settings for generated Excel file using xsl" New topic
Author

How to set Page Orientation and Print settings for generated Excel file using xsl

vedika ashtekar
Greenhorn

Joined: Dec 15, 2008
Posts: 19
Hello All,

We are using xmldata and xsl file and using processor we are creating Excel file. xml is simple data embeded in tags. in Xsl file we are using



Now I want to set the print settings for created Excel file . It's Page Orientation to 'Landscape' and want to add scaling as 'Fit-all-Columns'. I am trying but not getting much information on setting Print options. Can anybody help me out, it's urgent.

Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18138
    
    8

In the absence of any documentation, here's what I suggest:

Generate the Excel XML file without the print settings and save it. Load it into XML. Apply the print settings which you want, and save it in the XML format. Then look at the file you just saved and see what's different about it.

Documentation for this format does exist, by the way. It was produced by Microsoft at the time they applied for the standards authority approval from, I forget where. Maybe ECMA? Anyway there was a 6000-page PDF document produced at that time which documented the Office XML formats (which are your search keywords on Microsoft's site by the way), so you could try to track that down.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 464
    
    2
@vedika ashtekar
This may help, in particular, check out the use of <x:FitWidth>1</x:FitWidth> on page 3.
http://www2.sas.com/proceedings/sugi30/092-30.pdf
vedika ashtekar
Greenhorn

Joined: Dec 15, 2008
Posts: 19
Thanks @g tsuji. I checked your reply just now and yes whatever you have suggested is the perfect solution. Last eve I was trying to find the solution and I came across the same link you had posted here.
And I could solve my problem. still thanks for mentioning the link.

I added <style>@page {mso-page-orientation:landscape;}</style> in my .xsl file to set the page Orientation to Landscape.
and print settings to FIT ALL COLUMNS of generated Excel file on one page i have added following code
<x:WorksheetOptions>
<x:FitToPage/>
<x:Print>
<x:FitWidth>1</x:FitWidth>
<x:FitHeight>1000</x:FitHeight>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>

Finally could able to make it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to set Page Orientation and Print settings for generated Excel file using xsl
 
Similar Threads
splitting xsl file :creating dynamically
Flying Saucer Configuration File
styling in excel sheet
Simple XSL problem: parent attributes
XMLSS to XML