Excel 2007 PageSetup.FitToPagesWide问题

虽然我一直在尝试使用C#设置Excel 2007的Microsoft Visual Studio项目中的页面缩放页面,

代码看起来像这样

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; } 

PaperSise和Orientation的行可以正常工作,但是我不能让Excel将数据合并到一个页面上。

难道我做错了什么 ?

MSDN没有什么帮助,因为他们还没有这种语言的代码示例。

我应该清楚地阅读我提到的页面上的备注部分。 它指出:

“如果Zoom属性为True,则会忽略FitToPagesTall属性。”

现在我的代码看起来像这样,就像魅力一样

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