Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I am busy developing an application that does a lot of data manipulation on Excel spreadsheet "templates". In Excel (2010), you can manually create SubTotal by using the Data > Subtotal feature.

What I need to do now however, is to interrogate an existing spreadsheet, and find out which fields are being used as the "group by" and "subtotal" fields. It is fairly easy to add the subtotal in code, but seeminly impossible to reverse-lookup the subtotal fields.


C#
region applies subtotalling on the sheet
int[] fieldsForSubtotal = new int[] { 9, 11 };

range.Subtotal(5, Excel.XlConsolidationFunction.xlSum, fieldsForSubtotal, missing, missing, Excel.XlSummaryRow.xlSummaryBelow);

#endregion



I have googled quite a bit for this one, but can't seem to find any way of doing the reverse lookup bit. Please help?


Thanx,
Michelle
Posted
Comments
Kenneth Haugland 26-Jul-12 8:54am    
I dont know how may designated exsperts there are on VSTO here, but I got several answers regarding VSTO over here at a designated VSTO forum:

http://social.msdn.microsoft.com/Forums/en-US/vsto/threads
Michelle Phoenix 26-Jul-12 9:34am    
I am trying to post my question there as well, but keep on getting "unexpected error" errors :(. Will try again in an hour or so. Thanx in the meantime!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900