Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPPlus set default worksheet

I am using EPPlus v4.1 to generate an excel file in C#.

Is there a way to set a specific worksheet as the default worksheet? (when the user is opening the exported file, that sheet should be shown)

I could not find a method or property on ExcelWorkbook or ExcelWorksheets classes.

like image 318
sebastian.roibu Avatar asked Dec 12 '19 16:12

sebastian.roibu


2 Answers

I found the answer meanwhile. I don't want to delete the question because it might be useful to someone else.

//this line sets the first tab in the excel file as default/active
    Workbook.Worksheets.First().Select();
like image 152
sebastian.roibu Avatar answered Nov 01 '22 00:11

sebastian.roibu


For EPPlus 5 the answer is:

sheet.View.SetTabSelected();
like image 40
Wektar Avatar answered Nov 01 '22 00:11

Wektar