First sheet in workbook can not be hidden

Hi please try following examples

---EXAMPLE #1 - Sheet is hidden ---

Workbook wb = new Workbook();

wb.Worksheets.Clear();

wb.Worksheets.Add("Another Sheet");

Worksheet ws = wb.Worksheets.Add("New");

ws.IsVisible = false;

wb.Save(@"Result.xlsx", FileFormatType.Excel2007Xlsx);

---EXAMPLE #1 END ---

---EXAMPLE #2 - Sheet is not hidden ---

Workbook wb = new Workbook();

wb.Worksheets.Clear();

Worksheet ws = wb.Worksheets.Add("New");

ws.IsVisible = false;

wb.Worksheets.Add("Another Sheet");

wb.Save(@"Result.xlsx", FileFormatType.Excel2007Xlsx);

---EXAMPLE #2 END ---

Hi,

I have tested your code with the attached latest version/fix and it works absolutely fine. The worksheet named “New” is hidden (in the example 2).

Please try the attached version and let us know if it works fine.

Thank you.

Sorry this did not help. Please use example #2.

Hi,

Well, it works absolutely fine with v4.8.1.10, see the output xlsx file using your code here.

Thank you.

Well I get same result when I remove SetLicense call.

Have you tried creating xlsx file with license?

Use code below

Aspose.Cells.License license = new Aspose.Cells.License();

license.SetLicense("AsposeIsBuggy.Aspose.Cells.lic");

Workbook wb = new Workbook();

wb.Worksheets.Clear();

Worksheet ws = wb.Worksheets.Add("New");

ws.IsVisible = false;

wb.Worksheets.Add("Another Sheet");

wb.Save(@"Result.xlsx", FileFormatType.Excel2007Xlsx);

Hi,

Yes, now we found the issue using the license file.

We will figure it out soon. Your issue has been logged into our issue tracking system with an issue id: CELLSNET-12871.

Thank you.

Hi,

Please change your code a bit (add one line of code regarding activating sheet) as the following:

Aspose.Cells.License license = new Aspose.Cells.License();
license.SetLicense("e:\\Licenses\\Aspose.Cells.lic");

Workbook wb = new Workbook();
wb.Worksheets.Clear();
Worksheet ws = wb.Worksheets.Add("New");
ws.IsVisible = false;
wb.Worksheets.Add("Another Sheet");
wb.Worksheets.ActiveSheetIndex = 1;
wb.Save(@"e:\test\outputFile.xlsx");

In MS Excel, if there is only a visible worksheet in a workbook and you want to to set it not visible, you will get an exception. We will work as MS Excel in the next fix that we will provide you soon. And we will auto change the active worksheet when making an active worksheet not visible.

Thank you.

Thanks. I am using example #1 for now.

Hi,

Please try the attached version/fix. If you try to make an active worksheet that is not visible, we will auto change the active worksheet. If there’s no visible worksheet in a workbook, an exception
will be thrown.

Workbook wb = new Workbook();
wb.Worksheets.Clear();
Worksheet ws = wb.Worksheets.Add(“New”);
wb.Worksheets.Add(“Another Sheet”);

ws.IsVisible = false;

wb.Save(@"e:\test\outputFile.xlsx");

Thank you.

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


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