使用EPPLUS c#在一页上安装所有列

问题描述 投票:1回答:1

我想在一页上设置打印机设置Fit All列,epplus可以任意,请帮助我的代码:

        Worksheet.PrinterSettings.PaperSize = ePaperSize.A4;
        Worksheet.PrinterSettings.Orientation = eOrientation.Landscape;
        Worksheet.PrinterSettings.FitToPage = true;
        Worksheet.PrinterSettings.FitToWidth = 1;
c# epplus
1个回答
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;
© www.soinside.com 2019 - 2024. All rights reserved.