static void AppendRowDividendiToSheet(IXLWorksheet sheet, int rowIndex, Dividendo importo) { var row = sheet.Row(rowIndex); row.Cell("A").Value = importo.Simbolo; row.Cell("B").Value = importo.Descrizione; row.Cell("C").Value = importo.Data; row.Cell("D").Value = importo.Importo; row.Cell("E").Value = importo.Conto; }
static Dividendo[] CaricaDividendi(string file, string conto) { var result = new List <Dividendo>(); using (var sourceFile = new XLWorkbook(file)) { foreach (var ws in sourceFile.Worksheets.Where(w => w.Name == "Dividendi")) { var lastRow = ws.LastRowUsed(); var importi = ws.Rows(2, lastRow.RowNumber()).Select(d => Dividendo.TryParse(d, conto)).ToArray(); foreach (var importo in importi) { if (importo.IsValid()) { result.Add(importo); } } } } return(result.ToArray()); }