aspose-cells / Aspose.Cells-for-Java

Aspose.Cells for Java examples, plugins and showcases
https://products.aspose.com/cells/java
MIT License
146 stars 100 forks source link

HiddenSheet isVisible #68

Open aplis1 opened 1 year ago

aplis1 commented 1 year ago

Hi,

I have a Excel file which contains a hidden sheet. For each sheet in the excel file. If I check like below: Worksheet ws = (Worksheet) worksheetObj; if (ws.isVisible() == false) { logger.info("Hidden sheet found {} ", ws.getName()); }

I never i get to the logger statement because even for the hidden sheet isVisible is always 0. Can somebody help how to know If the sheet is really hidden or not.

amjad-sahi commented 1 year ago

@aplis1,

Please note, if isVisible() returns "0", it means the sheet is hidden. Anyways, to evaluate your issue precisely, we need your template Excel file. So, kindly zip the Excel file and provide us here. Also, paste your complete sample (runnable) code that you are using. We will check your issue soon.

By the way, we also appreciate if you could post your queries/issue with resource file(s) in the dedicated forum. We handle users efficiently in the forums.

aplis1 commented 1 year ago

Hi, Thanks for the reply. I will update you soon.

amjad-sahi commented 1 year ago

Sure, please take your time.

aplis1 commented 1 year ago

Hi Amjad,

Sorry for the delay. I have uploaded sample repo including the excel file which has Sheet2 as hidden. In the AsposeUtility class. I have the following -

if (!ws.isVisible()) { logger.info("Hidden sheet found {} ", ws.getName()); } I was expecting for Sheet2 which was hidden to be printed. Please take a look.

amjad-sahi commented 1 year ago

@aplis1,

I checked your template Excel file "hiddenexcel2.xlsx" by downloading it from your repos. I found Sheet2 is not hidden at all. When I opened into MS Excel manually, it is shown/displayed, see the screenshot attached. sc_shot1

In short, your assumption regarding Sheet2 is wrong and this sheet is not hidden at all.

Let us know if you still have any issue or confusion.

aplis1 commented 1 year ago

Hi Amjad,

Sorry I uploaded the correct file with the sheet2 hidden. Please verify.

amjad-sahi commented 1 year ago

@aplis1 ,

I tested using your newly uploaded file "hiddenexcel2.xlsx" using the following sample code in a simple console Java program and it works absolutely fine. e.g. Sample code:

Workbook workbook = new Workbook("f:\\files\\hiddenexcel2.xlsx");
for (Object worksheetObj : workbook.getWorksheets()) {
    Worksheet ws = (Worksheet) worksheetObj;
    if (!ws.isVisible()) {
       System.out.println("Hidden sheet found " + ws.getName());
    }
}

console output: Hidden sheet found Sheet2

Which version of the API you are using? I am using latest version of the API (Please try latest version/fix: Aspose.Cells for Java 23.5 if you are not already using it).

aplis1 commented 1 year ago

Thanks It is working now.Not sure how if i am using a wrong excel file. Thanks for the help.

amjad-sahi commented 1 year ago

@aplis1 ,

Good to know that your issue is sorted out. In the event of further queries or issue, feel free to write us back.