Esempio n. 1
0
        public static void FormatMulti_Data_xslx(this ExcelWorksheet ws, string reportLayoutFilterId)
        {
            ws.Cells[1, 1, 1, ws.Dimension.End.Column].Merge = true;
            ws.Cells[2, 1, 2, ws.Dimension.End.Column].Merge = true;

            ws.Cells.AutoFitColumns();

            ws.PrinterSettings.Orientation             = ws.GuessPageOrientation();
            ws.PrinterSettings.RepeatRows              = ws.Cells["1:5"];
            ws.HeaderFooter.OddFooter.LeftAlignedText  = $"&6 {DateTime.Now.ToString("dd-mmm-yyyy hh:nn:ss")} ({reportLayoutFilterId})";
            ws.HeaderFooter.OddFooter.CenteredText     = $"&6{ExcelHeaderFooter.FilePath}{ExcelHeaderFooter.FileName}!{ExcelHeaderFooter.SheetName}";
            ws.HeaderFooter.OddFooter.RightAlignedText = $"&6Page {ExcelHeaderFooter.PageNumber} of {ExcelHeaderFooter.NumberOfPages}";
        }
Esempio n. 2
0
 public static void SetPageSetupToDefault(this ExcelWorksheet ws)
 {
     ws.HeaderFooter.OddFooter.LeftAlignedText  = "&6&[Date] &[Time]";
     ws.HeaderFooter.OddFooter.CenteredText     = "&6&[Path]&[File]!&[Tab]";
     ws.HeaderFooter.OddFooter.RightAlignedText = "&6Page &[Page] of &[Pages]";
     ws.PrinterSettings.BottomMargin            = 1.3m;
     ws.PrinterSettings.FitToWidth         = 1;
     ws.PrinterSettings.FooterMargin       = 0.5m;
     ws.PrinterSettings.HeaderMargin       = 0.5m;
     ws.PrinterSettings.HorizontalCentered = true;
     ws.PrinterSettings.LeftMargin         = 0.5m;
     ws.PrinterSettings.Orientation        = ws.GuessPageOrientation();
     ws.PrinterSettings.RightMargin        = 0.5m;
     ws.PrinterSettings.TopMargin          = 0.5m;
 }