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

Free Support Forum - aspose.com

Subtotalling a range has the last subtotal row in a row 1 row lower than it should be


We have found this issue where we get a extra row between the last group and the last subtotal formula row when we apply a subtotal to a known range. This seems to be causing an issue when we try to apply another subtotal to the subtotaled range.

I have attached a small project to demonstrate the issue. I have also attached an input file “input with a named ranged called TargetTable.xlsx” which contains a named range called “TargetTable”.

The code calls the Worksheet.Cells.Subtotal() method to apply the the subtotaling setting to the named range. I have caught the exception and saved the file when it fires (search for “Unknown object is null?” in Form1.cs).

If you run the project code to the end the following files will be created in the order:

  1. Subtotalling test_Tables converted to Named Range .xlsx
  2. “subtotalRow2ReApplied.xlsx”
  3. “subtotalRow3ReApplied.xlsx”
  4. “subtotalRow4ReApplied.xlsx”
  5. "subtotalReAppliedEndFile.xlsx"

If you look at the files 3-5 you will notice that the last group only has one subtotal row.


Thanks for your posting and using Aspose.Cells for .NET.

Please download and try the latest version Aspose.Cells
for .NET v7.5.1.2
and see if it works fine.

We have looked into your project and ran it, it generates only one file, which we have attached for your reference. It did not generate the 5 files which you have mentioned in your post.

Please also elaborate your issue with screenshots, it will help us sort out your issue easily.


I have downloaded the zip project I have attached in this thread and found that it is the right version. I have however posted a different project in a different thread that does generated a file called “generatedFile.xlsx”; that project may have overwritten your copy of this project if it was extracted onto the same folder as both zip files (although they have different titles) contains a folder with exactly the same name :S

I have repackage the project and attached it to this reply. It should not generate a file called “generatedFile.xlsx” at all.


Thanks for your posting and using Aspose.Cells for .NET.

Now your project generates the correct number of files as you mentioned in your post. Could you please also provide us some screenshots highlighting your issue in red circles? It will help us better understand your issue and we will be able to help you asap.


I have attached a screenshot of the issue on the generated file “Applying a subtotal to a range applies the last subtotal one row too low.PNG” and what it looks like when subtotaling in Excel “Applying a subtotal to a range applies the last subtotal one row too low.PNG”.

Thank you


I have downloaded and found that the issue is resolved in this version.

Thank you very much.


Thanks for your posting and using Aspose.Cells for .NET.

It is good to know that the latest version has fixed your issue. If you encounter any other issue, please feel free to post on our forums, we will be glad to help you further.