Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
125
Fit All Columns on One Page print mode
posted

Hi,

Is it possible to set 'Fit All Columns on One Page' print mode from code behind?

Look like PrintOptions.ScalingType enum contains only UseScalingFactor and FitToPages values. Setting PrintOptions.ScalingType = ScalingType.FitToPages forces the whole worksheet to be printed on a single page, which does not work for large files. UseScalingFactor option also does not look useful.

Please advise.

Thank you.

  • 44743
    Verified Answer
    posted

    Yes, it is possible. Setting the ScalingType to FitToPages is correct. After that, you need to set MaxPagesHorizontally and/or MaxPagesVertically. By default they are 1, which is why the whole worksheet is printed on a single page. If you set the MaxPagesVertically to 0, it will allow an unlimited number of pages. This will force a one page constraint for all columns, but leave the rows unconstrained.