本文介绍了Excel 2007中PageSetup.FitToPagesWide问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

For while I have been trying to set the Page Scaling of Excel page in a Microsoft Visual Studio project for Excel 2007 using C#

中的代码看起来像这样

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和方向线运作良好,但我不能让?Excel的数据拟合到一个页面

The lines for PaperSise and Orientation are working well, however I can't make Excel fit data onto one page.

我是不是做错了什么。

的没有太大帮助,因为他们还没有一个代码示例对于这门语言。

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

推荐答案

我应该有清晰的读我提到的页面上的注释部分。它指出:

I should have clearly read the Remarks section on the page I mentioned. It states:

如果Zoom属性为True,FitToPagesTall属性被忽略

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

And my code now looks like this, works like charm

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

这篇关于Excel 2007中PageSetup.FitToPagesWide问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 01:31