请问用C#操作Excel表怎么来获取或设置打印页面的大小

2025-01-05 21:55:34
推荐回答(1个)
回答1:

//表格全局样式
excel.ActiveSheet.PageSetup.LeftMargin = 0.64;//打印时左边距
excel.ActiveSheet.PageSetup.RightMargin = 0.34;
excel.ActiveSheet.PageSetup.TopMargin = 1.91;
excel.ActiveSheet.PageSetup.BottomMargin = 1.91;
excel.ActiveSheet.Rows.Font.Bold = true;
excel.ActiveSheet.Rows.Font.Size = 8;
excel.ActiveSheet.Rows.Font.Name = "宋体";
excel.ActiveSheet.Columns.ColumnWidth = 4;//默认列宽
excel.ActiveSheet.Rows.VerticalAlignment = Microsoft.Office.Interop.Excel.XlVAlign.xlVAlignCenter;
excel.ActiveSheet.Rows.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignCenter;