Applying Subtotal and Changing Direction of Outline Summary Rows below Detail

Images of source and output files

The following screenshot shows the source Excel file used in the sample code below which contains some data in columns A and B.

todo:image_alt_text

The following screenshot shows the output Excel file generated by the sample code. As you can see, subtotal has been applied to range A2:B11 and the direction of the outline is summary rows below detail.

todo:image_alt_text

C# code to apply subtotal and change the direction of outline summary rows

Here is the sample code to achieve the output as shown above.