Worksheet.IsVisible = false groups sheets

I see a strange behaviour when I run the code below on the attached document:

The two sheets that are still visible are "grouped" (a feature in Excel I was aware of). This causes problems for us.

Can you have a look at it?

class Sheets
{
public static void DoIt()
{
WorkbookDesigner designer = new WorkbookDesigner();
Workbook workbook = new Workbook(Constants.sourcePath + "Sheets.xlsx");
designer.Workbook = workbook;

foreach (Worksheet sheet in workbook.Worksheets)
{
if (sheet.Name == "Sheet3")
{
sheet.IsVisible = false;
}
}
string output = Constants.destPath + "Sheets_result.xlsx";
workbook.Save(output);
Process.Start(output);
}
}

Hi,


I have tested your code with your template file and it works fine with our latest version/fix (attached). Please try it.

I have also attached the output file here.

thank you.

Hi,

I have tested this issue using the latest version:
Aspose.Cells
for .NET v6.0.1.8


using your code and found it is working fine.

Please see the output workbook attached.

C#


string path = @“F:\Shak-Data-RW\Downloads\Sheets.xlsx”;


WorkbookDesigner designer = new WorkbookDesigner();

Workbook workbook = new Workbook(path);

designer.Workbook = workbook;


foreach (Worksheet sheet in workbook.Worksheets)

{

if (sheet.Name == “Sheet3”)

{

sheet.IsVisible = false;

}

}

string output =path + “.out.xlsx”;

workbook.Save(output);

Process.Start(output);


Hmm, this still doesn't work for me, I tried with the 6.0.1.8 version. I previously used 6.0.1.5. Did you make any changes to the code to make this work, or is this just the latest version you had at the time?

Note that as soon as you click on one of the sheet tabs at the bottom of the Excel window, the grouping will disappear.

I am attaching the input- and output-files. The sheets_result.xlsx should show "[Group]" at the title bar of Excel, indicating that Sheet 5 and 7 have been grouped.

Also, please try the attached Sheets.xlsx as input file, as is, without opening it. It seems as if the problem is rather hard to reproduce, but with the attached file it shows the problem.

Thanks!

/Fredrik

Hi Fredrik,


I can see the issue. To make the issue appear, I need to use valid license, see the following complete sample code:

Sample code:

Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense(@“E:\Licenses\24-1-2011\Aspose.Total.lic”);
string path = @“e:\test2\Sheets.xlsx”;
WorkbookDesigner designer = new WorkbookDesigner();
Workbook workbook = new Workbook(path);
designer.Workbook = workbook;
foreach (Worksheet sheet in workbook.Worksheets)
{

if (sheet.Name == “Sheet3”)
{

sheet.IsVisible = false;

}

}
string output = path + “_results.xlsx”;
workbook.Save(output);

I have logged the issue with an id: CELLSNET-30246. We will look into the issue soon.

Thank you.

Hi,

Please download and try the latest fix
Aspose.Cells for .NET v7.0.0.2


The issues you have found earlier (filed as 30246) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.