Changing the worksheets order.

Sep 10, 2014 at 1:46 AM
Hi..

I am trying to hide the first Worksheet in a workbook. This does not appear to work.
package.Workbook.Worksheets["Raw Hardware"].Hidden = OfficeOpenXml.eWorkSheetHidden.Hidden;
This table contains the "raw" data from which the following worksheets are created. I would like to be able to leave the worksheet in the workbook for audit purposes.

Is there a way to change the order so that the worksheet I am attempting to hide will be able to be hidden?
Sep 10, 2014 at 2:07 AM
Ok... so I figured out a workaround... not elegant, but it works.
                    var rawHardware = package.Workbook.Worksheets["Raw Hardware"];
                    package.Workbook.Worksheets.Add("RawHardware", rawHardware);
                    package.Workbook.Worksheets.Delete("Raw Hardware");
                    package.Workbook.Worksheets["RawHardware"].Name = "Raw Hardware";
Editor
Sep 10, 2014 at 11:21 AM
Strange, I didn't try EPPlus 4.x but I'm using this feature in some projects with 3.x and works fine. Do you open generated files with Excel or another compatible app ?