Ensuring Cell on the Right Side of the Workbook is Visible using C#.NET

Hello!

I am trying to make the last column (column AC) visible on the right-edge of the workbook. It is also acceptable to have the bordered line between columns R,S centered on the screen.

I have been struggling to accomplish this programmatically using Aspose. Is there a way to do this?

Screenshot of what we currently have (12.8 KB)

Screenshot of what we want (26.1 KB)

Thank you!

@danilolekovic,

The only difference b/w the two screenshots is related to bottom scrollbar where you scroll to right to get last column visible, is not it? Could you please give us your current output Excel by Aspose.Cells and your desired output Excel file (you may use MS Excel manually to get the desired output). We will check and help you on how to do it via Aspose.Cells APIs.

In case, you you want something else, kindly do elaborate with more details and samples.

PS. please zip the Excel files prior attaching.

Hi @Amjad_Sahi ,

Yes, that is exactly what I am trying to accomplish. I have attached before/after zips below.

Thank you!

Excel Examples.zip (15.2 KB)

@danilolekovic,

See the following sample code to accomplish the task for your reference. I used one of your file as input (template) file, use specific code segments to save the file as per your desired file:
e.g.
Sample code:

Workbook workbook = new Workbook("e:\\test2\\ExampleBook Before.xlsx");
workbook.Worksheets[0].ActiveCell = "A1";
//workbook.Worksheets[0].FirstVisibleColumn = 9;

PaneCollection panes = workbook.Worksheets[0].GetPanes();
panes.FirstVisibleColumnOfRightPane = 9;
workbook.Save("e:\\test2\\out1.xlsx");

Hope, this helps a bit.

1 Like

Thank you Amjad! This helps a lot.

@danilolekovic,

You are welcome.