Excel 2007 PageSetup.FitToPagesWide problem

Posted by adopilot on Stack Overflow See other posts from Stack Overflow or by adopilot
Published on 2010-03-24T16:43:52Z Indexed on 2010/03/24 17:03 UTC
Read the original article Hit count: 918

Filed under:
|

For while I am trying to set Page Scaling of Excel page in Microsoft Visual Studio project for Excel2007 using C#

Code looks like

private void Sheet1_Startup(object sender, System.EventArgs e)
        {
            PageSetup.FitToPagesWide = 1;  
            PageSetup.FitToPagesTall = 1;
            PageSetup.Orientation = Microsoft.Office.Interop.Excel.XlPageOrientation.xlLandscape;
            PageSetup.PaperSize = Microsoft.Office.Interop.Excel.XlPaperSize.xlPaperA4;
        }

Lines for PaperSise and Orientation are working well but, I can't make Excel to fit data to one page.

Am I doing something wrong ?

MSDN did not helped me much because they do not yet have a code sample for this language.

© Stack Overflow or respective owner

Related posts about excel

Related posts about c#