C#打印页面设置(横向,页宽,页高)
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;//水平居中
摘自 brian0031的专栏
补充:软件开发 , C# ,