Ability to Group rows with Microsoft Excel Interop C#

hydev used Ask the Experts™

I am using Visual Studio 2008 to automate some tasks in Excel 2007.  I have got most of what I need to do working but I am having difficulty getting the "Group" function to work.  This is where you can select some rows and then click the "Group" option in the Outline part of the Data tab on the ribbon.

Is it possible to do this?

Any help greatly appreciated.


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®


Yes that's pretty much spot on.  If anyone knows how to show collapsed rather than expanded then that would be perfect.

This is not the ideal solution but you can hide the rows of the range which will give you the same effect as collapsing the group.  The plus sign shows up on the left hand side of the range if you are grouping rows.  The rows can be revealed by clicking the plus sign.
i do not know c# but the code should be something similar to the following, with a few missing key words in there somewhere.
range.rows.hidden = true

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial