Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I've been using the Microsoft.Office.Interop.Excel dll to work with Excel in my offline C# programs. When I made the move to ASP.Net website applications, I found that this dll no longer worked because of issues with server-side security. This is why I decided to start using ClosedXML. I've found multiple uses for ClosedXML but there is one issue.

How would I retrieve the active/selected cell from the spreadsheet?

I am trying to add this feature because my users need to click on the spreadsheet and update cells with values calculated by the C# code.

What I have tried:

I have tried using sheet.RangeUsed, but that gives the range of entire sheet
Posted
Updated 16-Oct-18 6:51am

You can't.

ClosedXML doesn't deal with an interactive Excel instance. It simply reads and modifies the contents of the file. The user can't see or interact with the file you're manipulating.

And no, you can't use Office Interop to do that either. Your code is running on the server, so if you brought up an interactive Excel instance, the user would never see it.
 
Share this answer
 
When you working with the Excel sheet on the server, there is no such thing as the "active cell".

Since server-side code also has no way of interacting with an instance of Excel on the client.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900