使用EPPLUS c#将所有列放在一页上

时间:2018-08-02 09:38:35

标签: c# epplus

我想用epplus设置打印机设置“适合所有”列在一页上,请问可以帮助 我的代码:

        Worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
        Worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
        Worksheet.PrinterSettings.FitToPage = true;
        Worksheet.PrinterSettings.FitToWidth = 1;

1 个答案:

答案 0 :(得分:5)

我认为这有点直觉,但您还必须设置worksheet.PrinterSettings.FitToHeight = 0才能使它起作用。

这是设置打印工作表时通常使用的代码:

            worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
            worksheet.PrinterSettings.Orientation = eOrientation.Portrait;
            worksheet.PrinterSettings.HorizontalCentered = true;
            worksheet.PrinterSettings.FitToPage = true;
            worksheet.PrinterSettings.FitToWidth = 1;
            worksheet.PrinterSettings.FitToHeight = 0;