Free Support Forum - aspose.com

Microsoft.interops.excel code to aspose.cells

I want to convert this code below which is written using microsoft.interops.excel .Now I need to convert similar functionality in aspose.cell using dotnet core
" worksheetrd.Application.ActiveWindow.SplitRow = 1;
worksheetrd.Application.ActiveWindow.FreezePanes = true;

@sohailbujhs,

See sample code segment on freezing panes using Aspose.Cells for your reference:
e.g.
Sample code:

.......
     // Accessing the first worksheet in the Excel file
    Worksheet worksheet = workbook.Worksheets[0];

    // Applying freeze panes settings
    worksheet.FreezePanes(3, 2, 3, 2);

Also, see the document for your complete reference.

I have read the document but I need to understand how you decided the splitRow =1(Microsoft.excel) into FreezePanes(3, 2, 3, 2);(Aspose) in the above sample code

@sohailbujhs,

You got to adjust and set the FreezePanes parameters accordingly.
See sample examples:

// Applying freeze panes settings on A2
            worksheet.FreezePanes(1, 0, 1, 0); 

// Applying freeze panes settings at F6.
           worksheet.FreezePanes(3, 5, 3, 5);

In case you still find any issue or confusion, let us know with details and sample expected file (please zip the file prior attaching here), we will check and help you through.

I need to convert this code also given below into aspose.cells inside dotnet core
" worksheetrd.Application.ActiveWindow.SplitRow = 2;
worksheetrd.Application.ActiveWindow.FreezePanes = true;

and

" worksheetrd.Application.ActiveWindow.SplitRow = 1;
worksheetrd.Application.ActiveWindow.FreezePanes = true;

@sohailbujhs,
We are gathering information about this and will share our feedback soon.

so add some info I was using microsoft.interops.excel nuget but now we plan to use aspose.cells nuget

@sohailbujhs
If you want to freeze the entire rows or columns, please refer to the following code:
var workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//freeze whole rows
worksheet.FreezePanes(2, 0, 2, 0);
//freeze whole columns:
// worksheet.FreezePanes(0, 2, 0, 2);
workbook.Save(dir + “dest.xlsx”);

And what about this split given in this segment of mine
“worksheetrd.Application.ActiveWindow.SplitRow = 2”.Will FreezePane will do that as well ?

@sohailbujhs,

For splitting (windows) panes, you may try to use Worksheet.Split method. See the document with example code for your reference:

If you still find any issue or confusion, let us know with details and sample file (containing your desired splitted rows and frozen panes), we will check and help you through via sample code by Aspose.Cells APIs.

PS. please zip the file prior attaching.