We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get shapes from particular cell area

Hi,

I need a help to find the shapes in a particular cell area in .Net application using Aspose.Cells.

Im using below code to get cell area in the worksheet.

Workbook _workBook;

_workBook = new Workbook(fileName, loadOptions);

Worksheet workSheet = null;

foreach (Worksheet worksheet in _workBook.Worksheets)

{

CellArea[] pages = workSheet.GetPrintingPageBreaks(_printOptions);

CellArea page = pages[pageNo];

StringBuilder sb = new StringBuilder();

for (int iRow = page.StartRow; iRow <= page.EndRow; iRow++)

{

for (int iCol = page.StartColumn; iCol <= page.EndColumn; iCol++)

{

}

}

}

I need to find shapes betwwen page.StartRow and Page.EndColumn.

Thanks,

Dhivya

Hi,


There is no direct way to do it. You have to use your own code accordingly. You need to adjust/correct the below code accordingly as this is just a hint.

See the sample code below:
//…
foreach (Aspose.Cells.Drawing.Shape shape in wrkb.Worksheets[0].Shapes)
{

for (int iRow = page.StartRow; iRow <= page.EndRow; iRow++)
{
for (int iCol = page.StartColumn; iCol <= page.EndColumn; iCol++)

{
if (page.StartRow <= shape.UpperLeftRow && page.RowRow >= shape.LowerRightRow && page.StartColumn <= shape.UpperLeftColumn && page.EndColumn >= shape.LowerRightColumn)
{
//Your code goes here

}
}
}