public static List <RawDataItem> Read() { List <RawDataItem> dataList = new List <RawDataItem>(); string fileName = GetRawDataFileName(); XSSFWorkbook workbook; using (FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read)) { workbook = new XSSFWorkbook(file); } int numberOfSheets = workbook.NumberOfSheets; for (int i = 0; i < numberOfSheets; i++) { ISheet sheet = workbook.GetSheetAt(i); RawDataItem rdi = new RawDataItem { Name = sheet.SheetName }; for (int row = 0; row <= sheet.LastRowNum; row++) { var sheetRow = sheet.GetRow(row); if (sheetRow != null) { RawBadgeItem bi = new RawBadgeItem { Group = string.Empty }; var cell0 = sheetRow.GetCell(0); if (cell0 == null) { continue; } bi.Name = cell0.StringCellValue; var cell1 = sheetRow.GetCell(1); if (cell1 != null) { bi.Group = cell1.StringCellValue; } var cell2 = sheetRow.GetCell(2); if (cell2 != null) { bi.SetTitleID = (int)cell2.NumericCellValue; } rdi.Badges.Add(bi); } } dataList.Add(rdi); } return(dataList); }
public MyTabPage(RawDataItem rdi, TabControl parent) { _rdi = rdi; this.Name = rdi.Name; this.Text = rdi.Name; InitializeComponent(); this.listBox1.Top = this.textBox1.Height; this.listBox1.Width = parent.Width - 4; this.listBox1.Height = parent.Height - 26 - this.textBox1.Height; this.listBox1.Items.Clear(); this.listBox1.DrawItem += ListBox1_DrawItem; this.textBox1.KeyUp += TextBox1_KeyUp; this.textBox2.KeyUp += TextBox1_KeyUp; DrawMe(); }