Advanced Grouping with GemBox

I need some examples of how to do advanced grouping and formatting using GemBox and C#.
We use MVC

Thank You!
Crystal RouseWeb Developer/Database AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shaun VermaakTechnical Specialist/DeveloperCommented:
Post some screenshot of what you would have done in Excel directly and I will do my best to assist.

I have used Gembox Sheet and Document
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Crystal RouseWeb Developer/Database AdminAuthor Commented:
I have attached my Excel Template.  I just need help getting started.  How to format and merge rows and how to loop thru records inside of the tables.  Just a snippet or two to get me started....Thanks!
Report-Template.xlsx
0
Shaun VermaakTechnical Specialist/DeveloperCommented:
This is how I load Excel Sheet into a Turple
//Loads a dataset from Excel WorkSheet into a complex Dictionary.
private static Dictionary<Tuple<string, string>, string> LoadDataSetFromExcelWorkSheet(ExcelWorksheet SourceWorkSheet, int RowStart, int ColumnStart, int ColumnEnd, bool HasHeaders)
{
    Dictionary<Tuple<string, string>, string> returnValue = new Dictionary<Tuple<string, string>, string>();
    Dictionary<int, string> headers = new Dictionary<int, string>();

    int rowCnt = RowStart;
    while (SourceWorkSheet.Cells[rowCnt, ColumnStart].Value != null)
    {
        string rowGUID = Guid.NewGuid().ToString();
        if ((rowCnt == RowStart) && (HasHeaders))
        {
            //Load proper header names
            for (int i = ColumnStart; i <= ColumnEnd; i++)
            {
                headers.Add(i, SourceWorkSheet.Cells[rowCnt, i].Value.ToString());
            }
        }
        else
        {
            if ((rowCnt == RowStart) && (!HasHeaders))
            {
                //Load generic header names
                for (int i = ColumnStart; i <= ColumnEnd; i++)
                {
                    headers.Add(i, System.Guid.NewGuid().ToString());
                }
            }
            //Load records
            for (int i = ColumnStart; i <= ColumnEnd; i++)
            {
                string cellValue = "";
                try { cellValue = SourceWorkSheet.Cells[rowCnt, i].Value.ToString(); } catch { cellValue = ""; };
                returnValue.Add(new Tuple<string, string>(rowGUID, headers[i]), cellValue);
            }
        }

        ////Move to next row
        rowCnt++;
    }

    return returnValue;
}

Open in new window

1
Crystal RouseWeb Developer/Database AdminAuthor Commented:
Thank You!  This was exactly what I needed.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.