Free Support Forum - aspose.com

Freeze panes

I know that there are methods to freeze/unfreeze panes from the worksheet class, but is there a way to determine what the current freeze “status” is? (i.e. the number of rows and/or columns currently frozen as panes in a worksheet)

What I’m trying to do is using the workbookdesigner I am creating a worksheet from a template excel from database information. After I create the workbook from the template, I have to insert one or more rows (the number of rows varies) at the top of a worksheet. I tried setting the freeze panes in the excel template file, but when I insert the rows at the top, the number of “frozen” rows does not change to account for the inserted rows. So, if I have frozen the top 4 rows in my template, then I insert 4 rows above them, the final generated excel file still only has 4 frozen rows (the 4 rows I inserted). I thought about resetting the freeze panes in my code based on how many rows I inserted, but in order to do that I need to know how many rows were already frozen to start with (which also varies from template to template) and I could find no function in the API which would tell me what the current “frozen” status is.

So, is there a way to determine this, or can the Cells insertrow function be altered to account for freezepanes?

Hi,

Thanks for considering Aspose.

We will soon enhance Worksheet.FreezePanes() method in a way that the frozen rows will be changed accordingly on inserting rows which I think will fit your need.

Thank you.

Please try this attached version. We expose a new method: Worksheet.GetFreezedPanes.

///


/// Gets information about freezed panes.
///

/// First row index.
/// First column index.
/// Freezed row number.
/// Freezed panes number.
/// True if panes are freezed in this worksheet.
public bool GetFreezedPanes(ref int row, ref int column, ref int freezedRows, ref int freezedColumns)

That function works great, but this new version of Cells introduced a new error that I am unable to track down. It only occurs on about half of my templates. I get the error Value cannot be null. Parameter name: value. There are two places where it happens. Sometimes it happens when I call the workbookdesigner.process function and sometimes it happens when I call the insertrows function on a worksheet. I am attaching one of the templates that causes the error. The previous version of Cells I am using is 4.4.0.5. This version does not cause the errors on these templates.

Hi,

Thanks for the details.

We found the problem and will figure it out soon.

Thank you.

Hi,

Please try this fix.

We have fixed this bug which is caused by Insert rows method.