2

I'm looking for something like myCell.Parent or myCell.Worksheet to get the Worksheet object of a Cell in Aspose cells for .net. I didn't see any property on the Cell class that refers the Worksheet. Wondering if there is a way that I missed?

gsharp
  • 27,557
  • 22
  • 88
  • 134
  • The cell should be created or referenced from worksheet. There you should know the cell's parent or worksheet. – David.Chu.ca Feb 25 '11 at 21:12
  • I want to write some cool extension methods on the cell. therefore i need also the reference to the Worksheet, but i don't want to pass it as a parameter on the method. – gsharp Feb 25 '11 at 21:57

3 Answers3

2

Using the latest versions of Aspose.Cells for .NET (e.g Aspose.Cells for .NET v5.3.2 etc.) now, it is possible to get the parent worksheet from the cell object. You may simply use Cell.Worksheet property.

Amjad Sahi
  • 31
  • 2
0

I've also asked in the Aspose Forum. It's not possible yet, but the added my request as new feature request.

gsharp
  • 27,557
  • 22
  • 88
  • 134
-1

Convert or cast cell to Range and then you can find the Worksheet property:

Excel.Range myRange = (Excel.Range) myCell;
Excel.WorkSheet myWS = null;
if ( myCell != null ) {
   myWS = myRange.WorkSheet;
}
David.Chu.ca
  • 37,408
  • 63
  • 148
  • 190