Applying Subtotal and Changing Direction of Outline Summary Rows below Detail

Example

Screenshots comparing 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

Java code to apply subtotal and change direction of outline summary rows below detail

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