C#打印页面设置(横向,页宽,页高)

5 篇文章 0 订阅
1 篇文章 0 订阅
c#打印时页面设置
using Excel = Microsoft.Office.Interop.Excel;
Excel.Application tmpExcel = new Excel.ApplicationClass();
Excel.Workbook tmpbook = tmpExcel.Workbooks.Open(tmppath, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);  //表格的权限设定,如只读,密码,权限
//以下是添加新的sheet
Excel.Worksheet objsheet = (Excel.Worksheet)tmpbook.Worksheets.Add(Type.Missing, Type.Missing, Type.Missing);


objsheet.PageSetup.Orientation = XlPageOrientation.xlLandscape;//页面方向横向

objsheet.PageSetup.Zoom = false; //打印时页面设置,必须设置为false,下面的二行页高,页宽才有效
objsheet.PageSetup.FitToPagesTall = 1; //页高

objsheet.PageSetup.FitToPagesWide = 1; //页宽
 

objsheet.PageSetup.Zoom = 75;//打印时页面设置,缩放比例
objsheet.PageSetup.TopMargin = 0; //上边距为0
objsheet.PageSetup.BottomMargin = 0; //下边距为0
objsheet.PageSetup.LeftMargin = 0; //左边距为0
objsheet.PageSetup.RightMargin = 0; //右边距为0
objsheet.PageSetup.CenterHorizontally = true;//水平居中
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值