We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

The 'IsColumnHidden' property returns an incorrect value

Hi.

Currently I use the trial edition of Aspose.Cells (v17.8.0.0) and I need to detect hidden rows and columns. ‘cells.IsRowHidden()’ returns the correct value for a hidden row. But ‘cells.IsColumnHidden()’ always returns ‘false’ for a hidden column.
To reproduce the issue I use the following code:

        using (FileStream fs = new FileStream(@"<path to Excel workbook>", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
        {
            LoadOptions lo = new LoadOptions();
            lo.MemorySetting = MemorySetting.MemoryPreference;

            lo.LoadFilter = new LoadFilter(LoadDataFilterOptions.CellValue | LoadDataFilterOptions.Formula);

            Workbook workbook = new Workbook(fs, lo);
            Worksheet sheet = workbook.Worksheets["Sheet1"];
            Cells cells = sheet.Cells;

            bool isHidden = cells.IsColumnHidden(1);

            MessageBox.Show("Is column hidden: " + isHidden.ToString());

            isHidden = cells.IsRowHidden(1);

            MessageBox.Show("Is row hidden: " + isHidden.ToString());
        }

Is it a bug or I am doing something wrong? Please advise.

Thank you.

@GSergey,

Thanks for your query.

Well, if you need to detect if a column/row is hidden or not, you 'd better either not to filter options or use “LoadDataFilterOptions.All”, it will give correct results. So, you may change the line of code:
i.e.,
lo.LoadFilter = new LoadFilter(LoadDataFilterOptions.CellValue | LoadDataFilterOptions.Formula);
to:
lo.LoadFilter = new LoadFilter(LoadDataFilterOptions.All);

Let us know if you still have any issue.

@Amjad_Sahi

Thank you very much. It helped.

@GSergey,

Good to know that your issue is sorted out by the suggested line of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.