DeleteBlankRows() is deleting rows even if it has shapes on it

@shreyap Thank you for your feedback. We have implemented the requirements based on the previous description.

Based on your response, we have found that the requirements have changed. Would you like to provide your expected result file? We will further investigate your issue. We will check it soon.

@John.He

Requirements haven’t changed. I was under an impression that it is an untold expectation.
I have attached a document below depicting various cases. Please refer it and let me know.
It is worth mentioning that DeleteColumns() is working exactly I wish for it to behave.
The only issue is with DeleteRows()
File.zip (203.9 KB)

Thanks!

@shreyap,

Thanks for your feedback and sample file depicting various cases for your requirements. I have recorded with your file against your existing ticket “CELLSNET-56659” into our database. Please spare us little time and we will evaluate your requirements thoroughly and get back to you.

@amjad.sahi,
Is the issue resolved? I see that the status of the internal ticket you have created is in resolved state

@shreyap,

Yes, the issue regarding DeleteBlankRows has been resolved sometime ago. We apologize for not informing you earlier. The feature was introduced in Aspose.Cells v24.10. We recommend trying the latest version, Aspose.Cells v25.2, as it includes additional enhancements and fixes too.

Please let us know if you encounter any issues or have further questions.

@shreyap
Sorry for any inconvenience caused to you. We can still reproduce the issue by testing on the latest version v25.2 using the following sample code. Rows covered by images are deleted when calling Cells.DeleteBlankRows(). Please refer to the attachment. out_net.zip (206.1 KB)

Workbook wb = new Workbook(filePath + "File.xlsx");
wb.Worksheets[0].Cells.DeleteBlankRows();
wb.Save(filePath + "out_net.xlsx");

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-57838

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@shreyap,

Please change the line:

wb.Worksheets[0].Cells.DeleteBlankRows();

with:

wb.Worksheets[0].Cells.DeleteBlankRows(new DeleteBlankOptions() { DrawingsAsBlank = false });

it should work for the purpose.

@amjad.sahi ,
I used your approach to delete empty rows and columns. To some extent I was able to avoid the overlapping, but some extra rows are getting overlapped with the image. Attaching the excel file and output file for reference.
BYACCOUNT0.zip (423.2 KB)

I expect the output to be of the below format
Output.pdf (1.1 MB)

@shreyap
1.png (3.9 KB)

The placement type of the shape is Move and don’t size with cells.
So if rows or columns are deleted , the size of the shape should not be changed.
Please change placement type as Move and size with cells in MS Excel or try the following codes:

shape.Placement = PlacementType.MoveAndSize;

Hi @simon.zhao , @John.He , @johnson.shi , @amjad.sahi ,
Is there any fix related to this issue?

I tried this method, it does not work. My image is still overlapping few rows.

@shreyap

By referring to the solution provided by @simon.zhao and testing it on v25.3 using the following sample code, we can obtain the correct results. Please refer to the attachment. out_net.zip (206.0 KB)

Workbook wb = new Workbook(filePath + "File.xlsx");
ShapeCollection shapes = wb.Worksheets[0].Shapes;
int shapeCount = shapes.Count;
for (int i = 0; i < shapeCount; i++)
{
    Shape shape = shapes[i];
    shape.Placement = PlacementType.MoveAndSize;
}
wb.Worksheets[0].Cells.DeleteBlankRows();
wb.Save(filePath + "out_net.xlsx");

Would you like to try it on v25.3? If you still have questions, please provide your sample code and result file. We will check it soon.

@John.He , Can you please have a look at this zip and let me know if the latest version has solved the issue.
TestFile-output-pdf.zip (587.3 KB)

@shreyap
By testing with the newly provided sample files and the following sample code in v25.3, we can still obtain the correct results. Please refer to the attachment. out_net.zip (397.6 KB)

Workbook wb = new Workbook(filePath + "Testfile.xlsx");
ShapeCollection shapes = wb.Worksheets[0].Shapes;
int shapeCount = shapes.Count;
for (int i = 0; i < shapeCount; i++)
{
    Shape shape = shapes[i];
    shape.Placement = PlacementType.MoveAndSize;
}
wb.Worksheets[0].Cells.DeleteBlankRows();
wb.Save(filePath + "out_net.xlsx");
wb.Save(filePath + "out_net.pdf");

@John.He , I updated my aspose cells version to 25.3 and still not able to fix it.
Please refer to the code, testFile I have used and the output files generated and my expected output.
It is a priority. It would be great if it gets fixed. Thank you.
New folder1.zip (1.4 MB)

@shreyap,

Thanks for the template Excel file, sample app and output files.

Thank you for providing the template Excel file, sample application, and output files. I tested your scenario using the template Excel file and sample app, and I discovered the issue. I have recorded the resource files and my findings with your existing ticket “CELLSNET-57838” in our database. The issue remains “Open.” We will assess and investigate the issue soon.

@amjad.sahi ,
@John.He mentioned that with the testing on his/her machine he/she was able to fix the issue. Am I missing something?

@shreyap,

I guess this is because he is using a different file and code snippet. However, when I tested your sample app along with the template file from the “New folder1.zip” attachment, I encountered the issue.

@shreyap
By testing on the latest version v25.3 using the following sample code, we found that there are still differences between the result file and the expected result file. Please refer to the attachment. out_net.zip (392.5 KB)

Sorry for any inconvenience caused to you. We will continue to fix the issue and notify you promptly once there are updates.

The sample code as follows:

Workbook wb = new Workbook(filePath + "Testfile.xlsx");
ShapeCollection shapes = wb.Worksheets[0].Shapes;
int shapeCount = shapes.Count;
for (int i = 0; i < shapeCount; i++)
{
    Shape shape = shapes[i];
    shape.Placement = PlacementType.MoveAndSize;
}
DeleteBlankOptions options = new DeleteBlankOptions();
options.DrawingsAsBlank = false;
wb.Worksheets[0].Cells.DeleteBlankRows(options);
wb.Save(filePath + "out_net.xlsx");
wb.Save(filePath + "out_net.pdf");

@shreyap,

We are pleased to inform you that your issue (Ticket ID: “CELLSNET-57838”) has been resolved precisely. The fix/enhancement will be included in the next release (Aspose.Cells v25.4) scheduled for release in the first half of April 2025. You will be notified when the next version is released.