Export multiple sheets in Excel

Andrei Ignat edited this page Feb 4, 2016 · 4 revisions

Video demo at https://youtu.be/ZLjnZvP9m0U #Code

private static void Advanced_MultipleSheets()
        {
            var p = new Person { Name = "andrei", WebSite = "http://msprogrammer.serviciipeweb.ro/", CV = "http://serviciipeweb.ro/iafblog/content/binary/cv.doc" };
            var p1 = new Person { Name = "you", WebSite = "http://yourwebsite.com/" };
            var list = new List<Person>() { p, p1 };

            var kvp = new List<Tuple<string, string>>();
            for (int i = 0; i < 10; i++)
            {
                var q = new Tuple<string, string>("This is key " + i, "Value " + i);
                kvp.Add(q);
            }

            var export = new ExportExcel2007<Person>();
            var data = export.ExportMultipleSheets(new IList[] { list, kvp });
            File.WriteAllBytes("multiple.xlsx", data);
            Process.Start("multiple.xlsx");
        }
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.