예제 #1
0
 public void AddPage()
 {
     pages.Add(currentPage);
     currentPage = new Page {Name = "Page" + pages.Count};
 }
예제 #2
0
        private void SetWorkbookCells(ExcelPackage pck, Page p, ref int maxx, ref int maxy)
        {
            var worksheet = pck.Workbook.Worksheets.Add(p.Name);
            int x = 1, y = 1;
            var rows = new List<List<string>>();
            rows.Add(HeaderRows);
            rows.AddRange(p.Cells);

            foreach (var row in rows)
            {
                foreach (var cell in row)
                {
                    worksheet.Cells[y, x].Value = cell;
                    x++;
                    if (x > maxx)
                        maxx = x;
                }
                x = 1;
                y++;
                if (y > maxy)
                    maxy = y;
            }
        }