How to hide a large number of columns in an Excel spreadsheet using EPPlus?

I am using EPPlus version 3.1.3 to create a spreadsheet, and I want to hide all columns from column L to column XFD and all rows from the bottom row to the end. I am trying to hide columns using:

for (int i = 12; i <= 16384; i++) { worksheet.Column(i).Hidden = true; } 

This happens forever, although you need to run for this cycle. Does anyone know an alternative way to hide a large number of columns? I also don't know how to hide lines.

I am wondering if there is another solution outside of EPPlus, but I really do not want to add another library to it.

+5
source share
2 answers

I found a solution for columns.

I wanted to hide columns from 10 to 16384 (last). The following code did the trick and has good performance.

 //EPPlus 4.04 is used. Dim col As ExcelColumn = osheet.Column(10) col.ColumnMax = 16384 col.Hidden = True 
+5
source

Are any of these actions being performed?

 worksheet.columns("L:XFD").Hidden=True 

or

 worksheet.columns("12:16384").Hidden=True 

(please forgive me if they are a few miles away, since I don't know EPPlus too well)


EDIT

I think Sean Cheshire's comments answer your question?

 worksheet.cells("L:XFD").Hidden=True 

The specified link seems to confirm this: EPPlus - work with multiple columns by index rather than alphabetically.

+2
source

Source: https://habr.com/ru/post/1200946/


All Articles