我想調整我使用C#編寫的程序生成的Excel文件的打印設置。我想設置爲:'頁面適合(或適合)1頁'。 (在荷蘭語中是Blad passend maken voor 1 pagina):p 您可以選擇此選項:screenshot。C#Excel打印邊距
我知道利潤通過PageSetup
對象設置,但我無法找到如何做到這一點。
請幫我在這裏:)
我想調整我使用C#編寫的程序生成的Excel文件的打印設置。我想設置爲:'頁面適合(或適合)1頁'。 (在荷蘭語中是Blad passend maken voor 1 pagina):p 您可以選擇此選項:screenshot。C#Excel打印邊距
我知道利潤通過PageSetup
對象設置,但我無法找到如何做到這一點。
請幫我在這裏:)
你可以操縱Excel中設置使用Office Primary Interop Assemblies
更具體地說,this link告訴您如何使用Excel互操作(PIA辦公室的一部分)
操縱頁面設置這可能有幫助嗎?
osheet.PageSetup.PrintArea = "$A$5:$G$" & curLine + 1
osheet.PageSetup.PrintTitleColumns = "$A:$A"
osheet.PageSetup.PrintTitleRows = "$1:$4"
osheet.PageSetup.Orientation = XlPageOrientation.xlLandscape
osheet.PageSetup.CenterFooter = "SomeText"
obook.CustomViews.Add("Print Top Left", True, True)
[這是否回答你的問題?](http://stackoverflow.com/questions/2602408/set-margins-in-excel-using-excel-interop-vb-net) – 2013-03-08 15:44:55