public static PoSheet Read(string filePath)
        {
            var file = new PoSheet();

            WorkBook  workbook = WorkBook.Load(filePath);
            WorkSheet sheet    = workbook.WorkSheets.First();

            var lines = sheet.Rows;

            for (int i = PoSheet.StartLine; i < lines.Count; i++)
            {
                var line          = lines[i];
                var currentRecord = new PoRecord()
                {
                    msgid  = line.Columns[0].StringValue,
                    msgstr = line.Columns[1].StringValue
                };
                file.AddRecord(currentRecord);
            }
            return(file);
        }
Exemple #2
0
        public static PoSheet Read(string filePath)
        {
            var file = new PoSheet();

            Application xlApp       = new Application();
            Workbook    xlWorkbook  = xlApp.Workbooks.Open(filePath);
            _Worksheet  xlWorksheet = xlWorkbook.Sheets[1];
            Range       xlRange     = xlWorksheet.UsedRange;

            var lines = xlRange.Rows;

            for (int i = PoSheet.StartLine; i < lines.Count; i++)
            {
                var currentRecord = new PoRecord()
                {
                    msgid  = lines[i, 1].Value,
                    msgstr = lines[i, 2].Value
                };
                file.AddRecord(currentRecord);
            }
            return(file);
        }