Hide sheet

Hello,

is there any possibility to hide sheet programatically? Or are all new added sheets by default visible?

Regards, Boris

Hi Boris,

Yes. All new added sheets are visible by default. I will add a new property to enable you hide sheet at run time. It will be available at the start of next week.

Boris,

Please refer to http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Worksheet.IsProtected.html. It’s availabe in hotfix 2.3.3.

Hello Laurence,

I have still problem to SET the property Worksheet.IsProtected. I can only get it. Can you please help me.

Thank you.

Boris

Boris,

To protect a worksheet, please refer to Worksheet.Protect method and Worksheet.Protection property.

Hi Laurence,

I still can not understand how to hide a sheet programatically. Can you please give me an example how to do this.

Thanks.

Boris

Hi Boris,

You can try the following sample code:

Worksheet sheet = excel.Worksheets[0];

//Protect worksheet without a password
sheet.Protect(ProtectionType.All);

//Protect worksheet with a password
sheet.Protect(ProtectionType.All, ''mypassword", null);

Hi Laurence,

the problem is, I want to hide the sheet not to protect them. If I use the code above, I still can see the sheets for wich I applied the Worksheet.Protect(…) method. I can not write or delete in them but I see them.

Can you please help me. Thank you.

Boris

Sorry, I posted the incorrect guide.

Please use the Worksheet.IsVisible property.

@Borjanja,
Aspose.Excel is no more available now and it is replaced by Aspose.Cells. This new product has all the features available in Aspose.Excel as well as supports the latest features available in different versions of MS Excel. We can hide/hide sheets using this new product also as depicted in the following sample code:

//Instantiate a new Workbook.
Workbook workbook = new Workbook("Test.xlsx");

//Get the first sheet.
Aspose.Cells.Worksheet objSheet = workbook.Worksheets["Sheet1"];

//Hide the worksheet.
objSheet.IsVisible = false;

//Save As the Excel file.
workbook.Save(@"Output.xlsx");

You may refer to the following article for more information about hiding worksheet:
Show and Hide Worksheets and Tabs

For free trial version of this product refer to the following link:
Aspose.Cells for .NET (Latest Version)

Here is the link to a complete solution which can be used to test different features of this product without any effort.