Issue with MaxColumn property

Hi,

I am using aspose cells version 5.3.1.0.
Property MaxColumn or MaxDataColumn returns value “-1” for sheet index 1 on excel file “CTRLED00000086.xls”. But there are some data & chart in that particular sheet.

Cell1.Worksheets[1].Cells.MaxColumn
or
Cell1.Worksheets[1].Cells.MaxDataColumn

Herewith i have attached excel file “CTRLED00000086.xls”.

Regards,
Karthik

Hi,

Please try the attached version, I have tested with your file using the attached version, it works fine.
Sample code:
Aspose.Cells.Workbook wbk = new Aspose.Cells.Workbook(“e:\test2\CTRLED00000086.xls”);
Aspose.Cells.Worksheet worksheet = wbk.Worksheets[" Deposits"];
Aspose.Cells.Cells cells = worksheet.Cells;
int columnindex = cells.MaxColumn;

MessageBox.Show(columnindex.ToString());

columnindex = cells.MaxDataColumn;
MessageBox.Show(columnindex.ToString());

Thank you.

Hi,

The second sheet is hidden in this excel file.
And the sheet name is “___snlqueryparms” and the sheet index is 1.
foreach (Aspose.Cells.Worksheet ws in Cell1.Worksheets)


Regards,
Karthik

Hi,

There is nothing (neither data no charts) on that sheet “___snlqueryparms”. I tried the following code to re-save your template file to make the invisible sheet visible. I have also attached the output file here, you may see there is nothing on that sheet.

If you have different opinion, let us know with sheet’s screen shots and give us more details.

Thank you.

And here is the sample code that I am using:

Aspose.Cells.Workbook wbk = new Aspose.Cells.Workbook(“e:\test2\CTRLED00000086.xls”);
Aspose.Cells.Worksheet worksheet = wbk.Worksheets[1];
wbk.Worksheets[1].IsVisible = true;

Aspose.Cells.Cells cells = worksheet.Cells;
int columnindex = cells.MaxColumn;

MessageBox.Show(columnindex.ToString());

columnindex = cells.MaxDataColumn;
MessageBox.Show(columnindex.ToString());

wbk.Save(“e:\test2\RSCTRLED00000086.xls”);

Thank you.