Print width with an XML table in Excel

I have an XML spreadsheet that is automatically generated. Depending on the report, there are a different number of columns and rows.

When printing, I would like this to be set to Fit to Width (right now, if there are too many columns, it won’t fit on the page ... even when the landscape).

At first I used FitToPage, but for reports with hundreds of lines, he needed to go to several pages.

Any suggestions on how to do this?

+5
source share
2 answers

Figured it out ...

You need to use FitToPage

FitHeight ( ), ...

.

<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>
+3

VBA

.FitToPagesWide = 1

off PageSetup .

0

All Articles