Print Fit To Width with XML Spreadsheet in Excel
I have an XML Spreadsheet that is automatically generated. There is a varying amount of Columns and Rows depending on the report.
When printing I would like for it to Fit to Width (Right now if there are too many columns it will not fit on a page... even when landscape).
I was initially using 开发者_开发知识库FitToPage but for reports with hundreds of rows it needs to go onto multiple pages.
Any suggestions on how to do this?
Figured it out...
You have to use FitToPage
And FitHeight (which sets the number of pages to print to) to get it to fit to width and have multiple pages...
Here is an example of it working.
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<Layout x:Orientation="Landscape"/>
<Header x:Margin="0.3"/>
<Footer x:Margin="0.3"/>
<PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/>
</PageSetup>
<FitToPage/>
<Print>
<FitHeight>100</FitHeight>
<ValidPrinterInfo/>
<HorizontalResolution>600</HorizontalResolution>
<VerticalResolution>600</VerticalResolution>
</Print>
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>6</ActiveRow>
<ActiveCol>8</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
In VBA I'd use
.FitToPagesWide = 1
off of the PageSetup property of the sheet.
精彩评论