public void LoadConfigs() { // Add table page(s) if (Table != GOST.Standarts.None) { for (int i = 0; i < GetTablePagesCount(Rvt.Data.ExportElements.Count, ConfFile.Lines[(int)Table]); ++i) { WorkSheet newWS = AddWorkSheet(String.Format("Лист {0}", i + 1)); newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Table])); if (Pages == 0) { // Add stamp to page if (Stamp1 != GOST.Standarts.None) { newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Stamp1])); } // Add dop to page if (Dop1 != GOST.Standarts.None) { newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Dop1])); } } else { // Add stamp to page if (Stamp2 != GOST.Standarts.None) { newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Stamp2])); } // Add dop to page if (Dop2 != GOST.Standarts.None) { newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Dop2])); } } Pages++; } } // Add title page if (Title != GOST.Standarts.None) { WorkSheet newWS = AddWorkSheet("Титульный лист"); newWS.AddTable(GOST.LoadConfFile(ConfFile.Conf[(int)Title])); } }
public WorkSheet AddWorkSheet(string worksheetName, int position = -1) { if (position == -1) { IXLWorksheet ixlWorkSheet = WB.Worksheets.Add(worksheetName); WorkSheet newWS = new WorkSheet(ixlWorkSheet, worksheetName); WSs.Add(newWS); return(newWS); } else { IXLWorksheet ixlWorkSheet = WB.Worksheets.Add(worksheetName, position); WorkSheet newWS = new WorkSheet(ixlWorkSheet, worksheetName); WSs.Insert(position, newWS); return(newWS); } }