Free Support Forum - aspose.com

Bug - Aspose.Cells Name.IsVisible returns true for hidden cells

Hi there, we are using Aspose.Cells 4.8.1.7. In a proof of concept testing the Name.IsVisible property, I found that the property returns true for all named ranges regardless of whether they are hidden or not.

Can you fix this as soon as possible? We are using your component to extract content from thousands of Excel files for research purposes, and having the name visibility property properly evaluate to false is very important for us.

Thanks
Shan

Hi Shan,

I found the issue after an initial test, we will figure it out soon.

Your issue has been logged into our issue tracking system with an issue id: CELLSNET-14060. We will inform you when it is fixed.

Thank you.

Hi,

Please try the attached version/fix.

If you still find the issue, kindly post your template file(s) with details to reproduce the issue, we will check it soon.

Thank you.

Hi,



Thanks for sending us your template file via email.



After an initial test (to check the visibility for certain named
ranges), I found the issue you have mentioned. We will look into your
issue soon. We have also re-opened your issue “CELLSNET-14060”.





Thank you.

Hi,

<span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(31, 73, 125);”>After closely checking your issue, we come to know, only valid named ranges could be visible
in the Name Box. If the defined name is not a valid range e.g convlookup10, convlookup22, it will not be in the list
of the Name Box. The Name.<span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”;”>IsVisible works similar to Menu option Insert->Name-> Define name box (in MS Excel 2003). So, consequently it is not an issue.


Thank you.
<span style=“font-size: 11pt; font-family: “Arial”,“sans-serif”;”><span style=“font-size: 11pt; font-family: “Calibri”,“sans-serif”; color: rgb(31, 73, 125);”><o:p></o:p>



Amjad I didn’t understand your response. There definitely is an issue, maybe we’re not looking at exactly the same thing. My interpretation of Name.IsVisible is that it returns true if some portion of the cells that comprise the range for that name are visible. Is that how you define it to work?

If so, in the sample that I emailed to you, I found that Name.IsVisible was returning the value true for all named ranges that were defined in Excel, but whose cells were set to “Hide”. This was the case for named ranges comprising a single cell.

Let me know if my interpretation is accurate and if so, can you elaborate on your response? Are you saying that Name.IsVisible really just means “the named range exists in the Microsoft Excel named range manager”. If so, then what is the value add of the Name.IsVisible API? Since the property can only be accessed with an already existing Aspose “Name” instance, wouldn’t that then imply that every Name would always have IsVisible set to true then? I’m confused —

Related, it would be great if this feature were duplicated at the individual cell level, i.e. Range[x,y].IsVisible, so that the property could be queried for cells not a part of a named range.

Our goal is to extract content from Excel files and ignore any content marked as hidden by our staff. Unfortunately we won’t be able to do that.

Thx
Shan

Hi Shan,

We will get back to you soon.

Thank you.

Hi,

If you just want to know the referred range of the name
is hidden, you have to check whether all rows or all columns in the range are
hidden. See the following sample code:

Range range = workbook.Worksheets.Names[0].GetRange();

bool isAllHidden = true;

if (range != null)

{

if (!range.Worksheet.IsVisible)

{

Console.WriteLine("Worksheet is not visible.");

}

Cells cells = range.Worksheet.Cells;

for (int i = 0; i < range.RowCount; i++)

{

if (!cells.Rows[range.FirstRow + i].IsHidden)

{

isAllHidden = false;

break;

}

}

if (!isAllHidden)

{

isAllHidden = true;

for (int i = 0; i < range.ColumnCount; i++)

{

if (!cells.Columns[range.FirstColumn + i].IsHidden)

{

isAllHidden = false;

break;

}

}

}

}

if (isAllHidden)

{

Console.WriteLine("Name is not visible.");

}



Thank you.