Search code examples
c#printingepplus

EPPlus Print Area - column definition


I want to define a list of columns as an Excel PrintArea (by EPPlus, c#). I can define interval (first and last column of area) but I don't know how to define separate columns (for instance: A, C, F, G).

I can set interval like this:

listSheet.PrinterSettings.PrintArea = listSheet.Cells["A,G"];

Solution

  • PrintArea is an ExcelRangeBase so you can set it link any other range:

    listSheet.PrinterSettings.PrintArea = listSheet.Cells["A:A,G:G"];