protected static uint FindRowIndexByMarker(SpreadsheetDocument document, string marker)
        {
            WorkbookPart  workbookPart  = document.WorkbookPart;
            WorksheetPart worksheetPart = workbookPart.WorksheetParts.FirstOrDefault();
            Sheets        sheets        = workbookPart.Workbook.Sheets;
            Sheet         sheet         = sheets.GetFirstChild <Sheet>();

            SheetData             sheetData        = worksheetPart.Worksheet.Descendants <SheetData>().FirstOrDefault();
            SharedStringTablePart sharedStringPart = workbookPart.SharedStringTablePart;
            uint firstRow      = 1;
            int  startMarkerId = ExcelUtils.FindStringId(sharedStringPart, marker);

            foreach (Row rr in sheetData.Elements <Row>())
            {
                Cell cc = rr.Elements <Cell>().FirstOrDefault();
                if (cc != null)
                {
                    if ((cc.DataType == "s") && (Convert.ToInt32(cc.CellValue.Text) == startMarkerId))
                    {
                        break;
                    }
                }

                firstRow++;
            }
            return(firstRow);
        }
        public static ExcelParser GetParser(SpreadsheetDocument document)
        {
            WorkbookPart  workbookPart  = document.WorkbookPart;
            WorksheetPart worksheetPart = workbookPart.WorksheetParts.FirstOrDefault();
            Sheets        sheets        = workbookPart.Workbook.Sheets;
            Sheet         sheet         = sheets.GetFirstChild <Sheet>();

            SheetData             sheetData        = worksheetPart.Worksheet.Descendants <SheetData>().FirstOrDefault();
            SharedStringTablePart sharedStringPart = workbookPart.SharedStringTablePart;

            string startMarker   = "Счет";
            int    startMarkerID = ExcelUtils.FindStringId(sharedStringPart, startMarker);
            uint   firstRow      = 1;

            if (startMarkerID != -100)
            {
                firstRow = FindRowIndexByMarker(document, startMarker);
            }
            string formatMarker   = "КФО";
            int    formatMarkerID = ExcelUtils.FindStringId(sharedStringPart, formatMarker);

            if (startMarkerID != -100 || formatMarkerID != -100)
            {
                Row r = ExcelUtils.GetRow(sheetData, 1);
                if (Convert.ToInt32(ExcelUtils.GetCell(r, "A").CellValue.Text) == startMarkerID ||
                    Convert.ToInt32(ExcelUtils.GetCell(r, "D").CellValue.Text) == formatMarkerID)
                {
                    return(new ParserNewFormat());
                }
            }
            else
            {
                Row r = ExcelUtils.GetRow(sheetData, 1);
                if (ExcelUtils.GetCell(r, "A").DataType == CellValues.String &&
                    ExcelUtils.GetCell(r, "A").CellValue.Text == startMarker ||
                    ExcelUtils.GetCell(r, "D").DataType == CellValues.String &&
                    ExcelUtils.GetCell(r, "D").CellValue.Text == formatMarker)
                {
                    return(new ParserNewFormat());
                }
            }
            if (formatMarkerID != -100)
            {
                if (Convert.ToInt32(ExcelUtils.GetRow(sheetData, firstRow + 3).GetFirstChild <Cell>().CellValue.Text) == formatMarkerID)
                {
                    return(new ParserWhithInventoryNumber());
                }
            }
            return(new ParserWhithoutInventoryNumber());
        }