40263

Gembox - get address of ExcelCell

We are evaluating Gembox as a replacement for Aspose. I think I am going blind as one thing I cannot do is easily get the address (e.g. "B4") of an ExcelCell.

For example, when iterating through the cells, we may encounter an unexpected value and would like to tell the user where the error is.

var dodgyCell = sheet.Cells[rowIndex, colIndex];

The best workaround I have found if to create a CellRange of one cell and then use the startposition. i.e.:

var cr = sheet.Cells.GetSubrangeAbsolute(rowIndex, colIndex, rowIndex, colIndex); var message = "Dodgy value was found in cell " + cr.StartPosition

Surely there has to be an easier way?

Cheers

Answer1:

Seems that Original Poster has figured out the answer. Unfortunately it is not well visible so here it is again:

To convert row and column index to position string ("A1", "BN27", etc.) use static method CellRange.RowColumnToPosition(int row, int column)

<strong>UPDATE</strong> In newer versions of GemBox.Spreadsheet (3.9 and above) the ExcelCell has an additional Name property which returns cell's address.

Answer2:

I know you've had the answer you are looking for but since someone else recommended a commercial product, I encourage you to look at epplus which is free, and coincidentally, I happened to have used today for the first time. It has many advanced features and a very simple and intuitive API.

Answer3:

According to the Gembox documentation, there is a "CellRange.ToString Method" that 'Returns a String that represents the current CellRange.' You might want to try that.

Reference: http://www.gemboxsoftware.com/Spreadsheet/Help/index.aspx

Recommend

  • how to draw a pair of boy and a girl in a competition excel vba
  • Caret position not keeping track?
  • PHP Session/Cookie problems with Windows XP, Vista, IE and certain users
  • Casting to one class and calling function from sibling class?
  • MDX query from PHP
  • Docker command returns “invalid reference format”
  • What's the best way to get round a 'Potentially Dangerous Request' error in asp.net?
  • Error 1062 - Duplicate entry '127' for key 'PRIMARY' - can't find the reaso
  • py2neo raised finished(self) error
  • Windows Phone 7 databases
  • How to share localhost between two different Docker containers?
  • Acces device information with C# or VB
  • Connection timeout when installing chaincode using fabric-sdk-go
  • write jsonobject data to xml tags
  • interface java and scip - not generating the right classes
  • How to extract data between same html tags
  • LINQ: Unable to cast the type 'System.Int32' to type 'System.Object'
  • Embedding SQLServer CE in an installer
  • Detect and prevent/delay windows mobile power off
  • Android PHP Base64 decode with different results
  • SVN Commit failed with syntax error, unexpected '[' [duplicate]
  • Which Magento Domain Objects Use Layout XML Updates?
  • GitLab site is showing the plesk default page. What am i doing wrong?
  • Not allowed to load local resource Error
  • how to access a variable from a class using php extension?
  • how can resolve dodgy:unchecked/unconfirmed cast in sonar?
  • WPF: Resize item size to have all items visible
  • Exception handling as per java coding standards
  • Whats the right place for testhelper-classes? (phpunit/best practise)
  • SQL query to group by maximal sets of a column having inner consecutive distances below a threshold
  • Calling Worksheet functions from vba in foreign language versions of Excel
  • Retrieve list of sent friend requests from friend_request FQL table
  • NHibernate Validation Localization with S#arp Architecture
  • How can I send an e-mail from a vbs script
  • Accessing IRQ description array within a module and displaying action names
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • how does django model after text[] in postgresql [duplicate]
  • Getting Messege Twice Using IMvxMessenger