无法设置PageSetup类的Orientation属性 [英] Unable to set the Orientation property of the PageSetup class

查看:1064
本文介绍了无法设置PageSetup类的Orientation属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#中生成Excel的代码在本地工作正常,但在服务器中显示错误

并且在服务器中也适用于c#2.0



I have code for Generate Excel in c# it works fine in local but show error in server
and also work well for c# 2.0 in server

ExlApp.DisplayAlerts = false;
                WB = ExlApp.Workbooks.Open(EXLPath, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal, MissVal);
                WB.Activate();
                Microsoft.Office.Interop.Excel.Worksheet WS = (Microsoft.Office.Interop.Excel.Worksheet)WB.ActiveSheet;
                WS.PageSetup.Orientation = Microsoft.Office.Interop.Excel.XlPageOrientation.xlPortrait;
                WS.PageSetup.PaperSize = Microsoft.Office.Interop.Excel.XlPaperSize.xlPaperA4;
                WS.PageSetup.Zoom = false;
                WS.PageSetup.FitToPagesWide = 1;
                WS.PageSetup.FitToPagesTall = false;
                WS.PageSetup.RightMargin = ExlApp.InchesToPoints(0.2);
                WS.PageSetup.LeftMargin = ExlApp.InchesToPoints(0.2);
                WS.PageSetup.TopMargin = ExlApp.InchesToPoints(0);
                WS.PageSetup.BottomMargin = ExlApp.CentimetersToPoints(0.2);





谢谢



Thanks

推荐答案

请按照:http://support.microsoft.com/kb/291298 [ ^ ]


这篇关于无法设置PageSetup类的Orientation属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆