Example #1
0
        public UtilityBottle fuelExtraction(PDF file, string cylinderNumber)
        {
            UtilityBottle fuel = new UtilityBottle(null, null, null, null, null);
            //Extract Text From PDF
            String extractedText = StripPDF(file);
            //Split Text into List
            List <string> pdfList = new List <string>(extractedText.Split(new string[] { "\r\n" }, StringSplitOptions.None));

            //Loop through list and get specfic values
            for (int i = 0; i < pdfList.Count; i++)
            {
                //Span Value
                if (pdfList[i].Contains("Analyzed Cylinder Number(s):"))
                {
                    fuel.AnalysisCylinder = pdfList[i + 2];
                }

                //Lot Number
                if (pdfList[i].Contains("Lot Number:"))
                {
                    fuel.LotNumber = pdfList[i - 2];
                }

                //Certification Date
                if (pdfList[i].Contains("Certificate Issuance Date:"))
                {
                    fuel.CertificationDate = pdfList[i - 2];
                }
            }

            fuel.CylinderNumber = cylinderNumber;

            return(fuel);
        }
Example #2
0
        public UtilityBottle o2100Extraction(PDF file, string cylinderNumber)
        {
            UtilityBottle o2100 = new UtilityBottle(null, null, null, null, null);
            //Extract Text From PDF
            String extractedText = StripPDF(file);
            //Split Text into List
            List <string> pdfList = new List <string>(extractedText.Split(new string[] { "\r\n" }, StringSplitOptions.None));

            //Loop through list and get specfic values
            for (int i = 0; i < pdfList.Count; i++)
            {
                //Span Value
                if (pdfList[i].Contains("Analyzed Cylinder Number(s):"))
                {
                    o2100.AnalysisCylinder = pdfList[i + 2];
                }

                //Lot Number
                if (pdfList[i].Contains("Lot Number:"))
                {
                    o2100.LotNumber = pdfList[i - 2];
                }

                //Certification Date
                if (pdfList[i].Contains("Certificate Issuance Date:"))
                {
                    o2100.CertificationDate = pdfList[i - 2];
                }

                //Concentration
                if (pdfList[i].Contains("99.993"))
                {
                    string removePercentage = pdfList[i + 2].Replace(" %", "");
                    o2100.Concentration = removePercentage;
                }
            }

            o2100.CylinderNumber = cylinderNumber;

            return(o2100);
        }
Example #3
0
        public void WriteToCalSheet(string calSheetPath, SpanBottle nox500, SpanBottle nox2500, SpanBottle nox10k, SpanBottle no500,
                                    SpanBottle no2500, SpanBottle no10k, SpanBottle thc500, SpanBottle thc2500, SpanBottle thc10k,
                                    SpanBottle ch4500, SpanBottle ch42500, SpanBottle ch410k, SpanBottle co5000, SpanBottle coHigh,
                                    SpanBottle co216, SpanBottle egr16, SpanBottle o225, UtilityBottle n21, UtilityBottle n22,
                                    UtilityBottle n23, UtilityBottle n24, UtilityBottle air1, UtilityBottle air2, UtilityBottle air3,
                                    UtilityBottle air4, UtilityBottle o21001, UtilityBottle o21002, UtilityBottle o21003, UtilityBottle o21004,
                                    UtilityBottle fuel1, UtilityBottle fuel2)
        {
            //Create Application, Workbook, and Worksheet
            Microsoft.Office.Interop.Excel.Application excelApp       = new Microsoft.Office.Interop.Excel.Application();
            Microsoft.Office.Interop.Excel.Workbook    excelWorkbook  = excelApp.Workbooks.Open(calSheetPath);
            Microsoft.Office.Interop.Excel.Worksheet   excelWorksheet = (Microsoft.Office.Interop.Excel.Worksheet)excelWorkbook.Worksheets.get_Item(2);
            //Write values in cell locations

            if (nox500 != null)
            {
                //Nox 500
                excelWorksheet.Cells[5, 2] = nox500.CylinderNumber;
                excelWorksheet.Cells[5, 3] = nox500.LotNumber;
                excelWorksheet.Cells[5, 4] = nox500.CertificationDate;
                excelWorksheet.Cells[5, 5] = nox500.ExpirationDate;
                excelWorksheet.Cells[5, 6] = nox500.SpanValue;
                excelWorksheet.Cells[5, 7] = nox500.Unit;
                excelWorksheet.Cells[5, 8] = nox500.Tracability;
                //Cylinder Number
            }

            if (nox2500 != null)
            {
                //Nox 2500
                excelWorksheet.Cells[6, 2] = nox2500?.CylinderNumber;
                excelWorksheet.Cells[6, 3] = nox2500?.LotNumber;
                excelWorksheet.Cells[6, 4] = nox2500?.CertificationDate;
                excelWorksheet.Cells[6, 5] = nox2500?.ExpirationDate;
                excelWorksheet.Cells[6, 6] = nox2500?.SpanValue;
                excelWorksheet.Cells[6, 7] = nox2500?.Unit;
                excelWorksheet.Cells[6, 8] = nox2500?.Tracability;
            }

            if (nox10k != null)
            {
                //Nox 10k
                excelWorksheet.Cells[7, 2] = nox10k?.CylinderNumber;
                excelWorksheet.Cells[7, 3] = nox10k?.LotNumber;
                excelWorksheet.Cells[7, 4] = nox10k?.CertificationDate;
                excelWorksheet.Cells[7, 5] = nox10k?.ExpirationDate;
                excelWorksheet.Cells[7, 6] = nox10k?.SpanValue;
                excelWorksheet.Cells[7, 7] = nox10k?.Unit;
                excelWorksheet.Cells[7, 8] = nox10k?.Tracability;
            }

            if (no500 != null)
            {
                //No 500
                excelWorksheet.Cells[8, 2] = no500?.CylinderNumber;
                excelWorksheet.Cells[8, 3] = no500?.LotNumber;
                excelWorksheet.Cells[8, 4] = no500?.CertificationDate;
                excelWorksheet.Cells[8, 5] = no500?.ExpirationDate;
                excelWorksheet.Cells[8, 6] = no500?.SpanValue;
                excelWorksheet.Cells[8, 7] = no500?.Unit;
                excelWorksheet.Cells[8, 8] = no500?.Tracability;
            }


            if (no2500 != null)
            {
                //No 2500
                excelWorksheet.Cells[9, 2] = no2500?.CylinderNumber;
                excelWorksheet.Cells[9, 3] = no2500?.LotNumber;
                excelWorksheet.Cells[9, 4] = no2500?.CertificationDate;
                excelWorksheet.Cells[9, 5] = no2500?.ExpirationDate;
                excelWorksheet.Cells[9, 6] = no2500?.SpanValue;
                excelWorksheet.Cells[9, 7] = no2500?.Unit;
                excelWorksheet.Cells[9, 8] = no2500?.Tracability;
            }

            if (no10k != null)
            {
                //No 10k
                excelWorksheet.Cells[10, 2] = no10k?.CylinderNumber;
                excelWorksheet.Cells[10, 3] = no10k?.LotNumber;
                excelWorksheet.Cells[10, 4] = no10k?.CertificationDate;
                excelWorksheet.Cells[10, 5] = no10k?.ExpirationDate;
                excelWorksheet.Cells[10, 6] = no10k?.SpanValue;
                excelWorksheet.Cells[10, 7] = no10k?.Unit;
                excelWorksheet.Cells[10, 8] = no10k?.Tracability;
            }

            if (thc500 != null)
            {
                //THC 500
                excelWorksheet.Cells[11, 2] = thc500?.CylinderNumber;
                excelWorksheet.Cells[11, 3] = thc500?.LotNumber;
                excelWorksheet.Cells[11, 4] = thc500?.CertificationDate;
                excelWorksheet.Cells[11, 5] = thc500?.ExpirationDate;
                excelWorksheet.Cells[11, 6] = thc500?.SpanValue;
                excelWorksheet.Cells[11, 7] = thc500?.Unit;
                excelWorksheet.Cells[11, 8] = thc500?.Tracability;
            }


            if (thc2500 != null)
            {
                //THC 2500
                excelWorksheet.Cells[12, 2] = thc2500?.CylinderNumber;
                excelWorksheet.Cells[12, 3] = thc2500?.LotNumber;
                excelWorksheet.Cells[12, 4] = thc2500?.CertificationDate;
                excelWorksheet.Cells[12, 5] = thc2500?.ExpirationDate;
                excelWorksheet.Cells[12, 6] = thc2500?.SpanValue;
                excelWorksheet.Cells[12, 7] = thc2500?.Unit;
                excelWorksheet.Cells[12, 8] = thc2500?.Tracability;
            }

            if (thc10k != null)
            {
                //THC 10k
                excelWorksheet.Cells[13, 2] = thc10k?.CylinderNumber;
                excelWorksheet.Cells[13, 3] = thc10k?.LotNumber;
                excelWorksheet.Cells[13, 4] = thc10k?.CertificationDate;
                excelWorksheet.Cells[13, 5] = thc10k?.ExpirationDate;
                excelWorksheet.Cells[13, 6] = thc10k?.SpanValue;
                excelWorksheet.Cells[13, 7] = thc10k?.Unit;
                excelWorksheet.Cells[13, 8] = thc10k?.Tracability;
            }

            if (ch4500 != null)
            {
                //Ch4 500
                excelWorksheet.Cells[14, 2] = ch4500?.CylinderNumber;
                excelWorksheet.Cells[14, 3] = ch4500?.LotNumber;
                excelWorksheet.Cells[14, 4] = ch4500?.CertificationDate;
                excelWorksheet.Cells[14, 5] = ch4500?.ExpirationDate;
                excelWorksheet.Cells[14, 6] = ch4500?.SpanValue;
                excelWorksheet.Cells[14, 7] = ch4500?.Unit;
                excelWorksheet.Cells[14, 8] = ch4500?.Tracability;
            }


            if (ch42500 != null)
            {
                //CH4 2500
                excelWorksheet.Cells[15, 2] = ch42500?.CylinderNumber;
                excelWorksheet.Cells[15, 3] = ch42500?.LotNumber;
                excelWorksheet.Cells[15, 4] = ch42500?.CertificationDate;
                excelWorksheet.Cells[15, 5] = ch42500?.ExpirationDate;
                excelWorksheet.Cells[15, 6] = ch42500?.SpanValue;
                excelWorksheet.Cells[15, 7] = ch42500?.Unit;
                excelWorksheet.Cells[15, 8] = ch42500?.Tracability;
            }

            if (ch410k != null)
            {
                //CH4 10k
                excelWorksheet.Cells[16, 2] = ch410k?.CylinderNumber;
                excelWorksheet.Cells[16, 3] = ch410k?.LotNumber;
                excelWorksheet.Cells[16, 4] = ch410k?.CertificationDate;
                excelWorksheet.Cells[16, 5] = ch410k?.ExpirationDate;
                excelWorksheet.Cells[16, 6] = ch410k?.SpanValue;
                excelWorksheet.Cells[16, 7] = ch410k?.Unit;
                excelWorksheet.Cells[16, 8] = ch410k?.Tracability;
            }

            if (co5000 != null)
            {
                //CO(L)
                excelWorksheet.Cells[17, 2] = co5000?.CylinderNumber;
                excelWorksheet.Cells[17, 3] = co5000?.LotNumber;
                excelWorksheet.Cells[17, 4] = co5000?.CertificationDate;
                excelWorksheet.Cells[17, 5] = co5000?.ExpirationDate;
                excelWorksheet.Cells[17, 6] = co5000?.SpanValue;
                excelWorksheet.Cells[17, 7] = co5000?.Unit;
                excelWorksheet.Cells[17, 8] = co5000?.Tracability;
            }

            if (coHigh != null)
            {
                //CO(H)
                excelWorksheet.Cells[18, 2] = coHigh?.CylinderNumber;
                excelWorksheet.Cells[18, 3] = coHigh?.LotNumber;
                excelWorksheet.Cells[18, 4] = coHigh?.CertificationDate;
                excelWorksheet.Cells[18, 5] = coHigh?.ExpirationDate;
                excelWorksheet.Cells[18, 6] = coHigh?.SpanValue;
                excelWorksheet.Cells[18, 7] = coHigh?.Unit;
                excelWorksheet.Cells[18, 8] = coHigh?.Tracability;
            }

            if (co216 != null)
            {
                //CO2
                excelWorksheet.Cells[19, 2] = co216?.CylinderNumber;
                excelWorksheet.Cells[19, 3] = co216?.LotNumber;
                excelWorksheet.Cells[19, 4] = co216?.CertificationDate;
                excelWorksheet.Cells[19, 5] = co216?.ExpirationDate;
                excelWorksheet.Cells[19, 6] = co216?.SpanValue;
                excelWorksheet.Cells[19, 7] = co216?.Unit;
                excelWorksheet.Cells[19, 8] = co216?.Tracability;
            }

            if (egr16 != null)
            {
                //EGR
                excelWorksheet.Cells[20, 2] = egr16?.CylinderNumber;
                excelWorksheet.Cells[20, 3] = egr16?.LotNumber;
                excelWorksheet.Cells[20, 4] = egr16?.CertificationDate;
                excelWorksheet.Cells[20, 5] = egr16?.ExpirationDate;
                excelWorksheet.Cells[20, 6] = egr16?.SpanValue;
                excelWorksheet.Cells[20, 7] = egr16?.Unit;
                excelWorksheet.Cells[20, 8] = egr16?.Tracability;
            }

            if (o225 != null)
            {
                //O2 25%
                excelWorksheet.Cells[21, 2] = o225?.CylinderNumber;
                excelWorksheet.Cells[21, 3] = o225?.LotNumber;
                excelWorksheet.Cells[21, 4] = o225?.CertificationDate;
                excelWorksheet.Cells[21, 5] = o225?.ExpirationDate;
                excelWorksheet.Cells[21, 6] = o225?.SpanValue;
                excelWorksheet.Cells[21, 7] = o225?.Unit;
                excelWorksheet.Cells[21, 8] = o225?.Tracability;
            }

            if (n21 != null)
            {
                //N2 1
                excelWorksheet.Cells[23, 4] = n21?.AnalysisCylinder;
                excelWorksheet.Cells[24, 4] = n21?.CylinderNumber;
                excelWorksheet.Cells[25, 4] = n21?.LotNumber;
                excelWorksheet.Cells[26, 4] = n21?.CertificationDate;
            }

            if (n22 != null)
            {
                //N2 2
                excelWorksheet.Cells[23, 5] = n22?.AnalysisCylinder;
                excelWorksheet.Cells[24, 5] = n22?.CylinderNumber;
                excelWorksheet.Cells[25, 5] = n22?.LotNumber;
                excelWorksheet.Cells[26, 5] = n22?.CertificationDate;
            }

            if (n23 != null)
            {
                //N2 3
                excelWorksheet.Cells[23, 6] = n23?.AnalysisCylinder;
                excelWorksheet.Cells[24, 6] = n23?.CylinderNumber;
                excelWorksheet.Cells[25, 6] = n23?.LotNumber;
                excelWorksheet.Cells[26, 6] = n23?.CertificationDate;
            }

            if (n24 != null)
            {
                //N2 4
                excelWorksheet.Cells[23, 7] = n24?.AnalysisCylinder;
                excelWorksheet.Cells[24, 7] = n24?.CylinderNumber;
                excelWorksheet.Cells[25, 7] = n24?.LotNumber;
                excelWorksheet.Cells[26, 7] = n24?.CertificationDate;
            }

            if (air1 != null)
            {
                //Air 1
                excelWorksheet.Cells[29, 4] = air1?.AnalysisCylinder;
                excelWorksheet.Cells[30, 4] = air1?.CylinderNumber;
                excelWorksheet.Cells[31, 4] = air1?.LotNumber;
                excelWorksheet.Cells[32, 4] = air1?.CertificationDate;
            }

            if (air2 != null)
            {
                //Air 2
                excelWorksheet.Cells[29, 5] = air2?.AnalysisCylinder;
                excelWorksheet.Cells[30, 5] = air2?.CylinderNumber;
                excelWorksheet.Cells[31, 5] = air2?.LotNumber;
                excelWorksheet.Cells[32, 5] = air2?.CertificationDate;
            }

            if (air3 != null)
            {
                //Air 3
                excelWorksheet.Cells[29, 6] = air3?.AnalysisCylinder;
                excelWorksheet.Cells[30, 6] = air3?.CylinderNumber;
                excelWorksheet.Cells[31, 6] = air3?.LotNumber;
                excelWorksheet.Cells[32, 6] = air3?.CertificationDate;
            }

            if (air4 != null)
            {
                //Air 4
                excelWorksheet.Cells[29, 7] = air4?.AnalysisCylinder;
                excelWorksheet.Cells[30, 7] = air4?.CylinderNumber;
                excelWorksheet.Cells[31, 7] = air4?.LotNumber;
                excelWorksheet.Cells[32, 7] = air4?.CertificationDate;
            }

            if (o21001 != null)
            {
                //O2 100% 1
                excelWorksheet.Cells[41, 4] = o21001?.AnalysisCylinder;
                excelWorksheet.Cells[42, 4] = o21001?.CylinderNumber;
                excelWorksheet.Cells[43, 4] = o21001?.LotNumber;
                excelWorksheet.Cells[44, 4] = o21001?.CertificationDate;
                excelWorksheet.Cells[46, 4] = o21001?.Concentration;
            }

            if (o21002 != null)
            {
                //O2 100% 2
                excelWorksheet.Cells[41, 5] = o21002?.AnalysisCylinder;
                excelWorksheet.Cells[42, 5] = o21002?.CylinderNumber;
                excelWorksheet.Cells[43, 5] = o21002?.LotNumber;
                excelWorksheet.Cells[44, 5] = o21002?.CertificationDate;
                excelWorksheet.Cells[46, 5] = o21002?.Concentration;
            }

            if (o21003 != null)
            {
                //O2 100% 3
                excelWorksheet.Cells[41, 6] = o21003?.AnalysisCylinder;
                excelWorksheet.Cells[42, 6] = o21003?.CylinderNumber;
                excelWorksheet.Cells[43, 6] = o21003?.LotNumber;
                excelWorksheet.Cells[44, 6] = o21003?.CertificationDate;
                excelWorksheet.Cells[46, 6] = o21003?.Concentration;
            }

            if (o21004 != null)
            {
                //O2 100% 4
                excelWorksheet.Cells[41, 7] = o21004?.AnalysisCylinder;
                excelWorksheet.Cells[42, 7] = o21004?.CylinderNumber;
                excelWorksheet.Cells[43, 7] = o21004?.LotNumber;
                excelWorksheet.Cells[44, 7] = o21004?.CertificationDate;
                excelWorksheet.Cells[46, 7] = o21004?.Concentration;
            }

            if (fuel1 != null)
            {
                //Fuel 1
                excelWorksheet.Cells[35, 4] = fuel1?.AnalysisCylinder;
                excelWorksheet.Cells[36, 4] = fuel1?.CylinderNumber;
                excelWorksheet.Cells[37, 4] = fuel1?.LotNumber;
                excelWorksheet.Cells[38, 4] = fuel1?.CertificationDate;
            }

            if (fuel2 != null)
            {
                //Fuel 2
                excelWorksheet.Cells[35, 5] = fuel2?.AnalysisCylinder;
                excelWorksheet.Cells[36, 5] = fuel2?.CylinderNumber;
                excelWorksheet.Cells[37, 5] = fuel2?.LotNumber;
                excelWorksheet.Cells[38, 5] = fuel2?.CertificationDate;
            }



            //Save, Close, and Quit Excel
            excelWorkbook.Save();
            excelWorkbook.Close();
            excelApp.Quit();
        }
Example #4
0
        private void submitButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                proessBar.Visibility = Visibility.Visible;

                CalSheet calSheet = new CalSheet(calSheetTextBox.Text);



                proessBar.Value = 5;

                //Nox
                if (nox500TextBox.Text != "")
                {
                    PDF nox500Pdf = new PDF(directoryTextBox.Text + "\\" + nox500TextBox.Text);
                    nox500 = nox500Pdf.nox500Extraction(nox500Pdf);
                }

                if (nox2500TextBox.Text != "")
                {
                    PDF nox2500Pdf = new PDF(directoryTextBox.Text + "\\" + nox2500TextBox.Text);
                    nox2500 = nox2500Pdf.nox2500Extraction(nox2500Pdf);
                }

                if (nox10kTextBox.Text != "")
                {
                    PDF nox10kPdf = new PDF(directoryTextBox.Text + "\\" + nox10kTextBox.Text);
                    nox10k = nox10kPdf.nox10kExtraction(nox10kPdf);
                }

                proessBar.Value = 10;

                //NO(C)
                if (no500TextBox.Text != "")
                {
                    PDF no500Pdf = new PDF(directoryTextBox.Text + "\\" + no500TextBox.Text);
                    no500 = no500Pdf.no500Extraction(no500Pdf);
                }

                if (no2500TextBox.Text != "")
                {
                    PDF no2500Pdf = new PDF(directoryTextBox.Text + "\\" + no2500TextBox.Text);
                    no2500 = no2500Pdf.no2500Extraction(no2500Pdf);
                }

                if (no10kTextBox.Text != "")
                {
                    PDF no10kPdf = new PDF(directoryTextBox.Text + "\\" + no10kTextBox.Text);
                    no10k = no10kPdf.no10kExtraction(no10kPdf);
                }

                proessBar.Value = 15;

                //THC
                if (thc500TextBox.Text != "")
                {
                    PDF thc500Pdf = new PDF(directoryTextBox.Text + "\\" + thc500TextBox.Text);
                    thc500 = thc500Pdf.thc500Extraction(thc500Pdf);
                }

                if (thc2500TextBox.Text != "")
                {
                    PDF thc2500Pdf = new PDF(directoryTextBox.Text + "\\" + thc2500TextBox.Text);
                    thc2500 = thc2500Pdf.thc2500Extraction(thc2500Pdf);
                }

                if (thc10kTextBox.Text != "")
                {
                    PDF thc10kPdf = new PDF(directoryTextBox.Text + "\\" + thc10kTextBox.Text);
                    thc10k = thc10kPdf.thc10kExtraction(thc10kPdf);
                }

                proessBar.Value = 20
                ;
                //CH4
                if (ch4500TextBox.Text != "")
                {
                    PDF ch4500Pdf = new PDF(directoryTextBox.Text + "\\" + ch4500TextBox.Text);
                    ch4500 = ch4500Pdf.ch4500Extraction(ch4500Pdf);
                }

                if (ch42500TextBox.Text != "")
                {
                    PDF ch42500Pdf = new PDF(directoryTextBox.Text + "\\" + ch42500TextBox.Text);
                    ch42500 = ch42500Pdf.ch42500Extraction(ch42500Pdf);
                }

                if (ch410kTextBox.Text != "")
                {
                    PDF ch410kPdf = new PDF(directoryTextBox.Text + "\\" + ch410kTextBox.Text);
                    ch410k = ch410kPdf.ch410kExtraction(ch410kPdf);
                }

                proessBar.Value = 25;

                //CO(L)
                if (co5000TextBox.Text != "")
                {
                    PDF co5000Pdf = new PDF(directoryTextBox.Text + "\\" + co5000TextBox.Text);
                    co5000 = co5000Pdf.co5000Extraction(co5000Pdf);
                }

                //CO(H)
                if (coHighTextBox.Text != "")
                {
                    PDF coHighPdf = new PDF(directoryTextBox.Text + "\\" + coHighTextBox.Text);
                    coHigh = coHighPdf.coHighExtraction(coHighPdf);
                }

                //CO2
                if (co2TextBox.Text != "")
                {
                    PDF co2Pdf = new PDF(directoryTextBox.Text + "\\" + co2TextBox.Text);
                    co2 = co2Pdf.co216Extraction(co2Pdf);
                }

                proessBar.Value = 30;

                //EGR
                if (egrTextBox.Text != "")
                {
                    PDF egrPdf = new PDF(directoryTextBox.Text + "\\" + egrTextBox.Text);
                    egr = egrPdf.egr16Extraction(egrPdf);
                }

                //O2 25%
                if (o225TextBox.Text != "")
                {
                    PDF o225Pdf = new PDF(directoryTextBox.Text + "\\" + o225TextBox.Text);
                    o225 = o225Pdf.o225Extraction(o225Pdf);
                }

                proessBar.Value = 35;

                //N2
                if (n21TextBox.Text != "")
                {
                    string replacetext = n21TextBox.Text.Replace("N2 1", "");
                    PDF    n21Pdf      = new PDF(directoryTextBox.Text + "\\" + n21TextBox.Text);
                    n21 = n21Pdf.n2Extraction(n21Pdf, replacetext.Replace(".pdf", ""));
                }

                if (n22TextBox.Text != "")
                {
                    string replacetext = n22TextBox.Text.Replace("N2 2", "");
                    PDF    n22Pdf      = new PDF(directoryTextBox.Text + "\\" + n22TextBox.Text);
                    n22 = n22Pdf.n2Extraction(n22Pdf, replacetext.Replace(".pdf", ""));
                }

                if (n23TextBox.Text != "")
                {
                    string replacetext = n23TextBox.Text.Replace("N2 3", "");
                    PDF    n23Pdf      = new PDF(directoryTextBox.Text + "\\" + n23TextBox.Text);
                    n23 = n23Pdf.n2Extraction(n23Pdf, replacetext.Replace(".pdf", ""));
                }

                if (n24TextBox.Text != "")
                {
                    string replacetext = n24TextBox.Text.Replace("N2 4", "");
                    PDF    n24Pdf      = new PDF(directoryTextBox.Text + "\\" + n24TextBox.Text);
                    n24 = n24Pdf.n2Extraction(n24Pdf, replacetext.Replace(".pdf", ""));
                }

                proessBar.Value = 40;

                //Air
                if (air1TextBox.Text != "")
                {
                    string replacetext = air1TextBox.Text.Replace("Air 1", "");
                    PDF    air1Pdf     = new PDF(directoryTextBox.Text + "\\" + air1TextBox.Text);
                    air1 = air1Pdf.airExtraction(air1Pdf, replacetext.Replace(".pdf", ""));
                }

                if (air2TextBox.Text != "")
                {
                    string replacetext = air2TextBox.Text.Replace("Air 2", "");
                    PDF    air2Pdf     = new PDF(directoryTextBox.Text + "\\" + air2TextBox.Text);
                    air2 = air2Pdf.airExtraction(air2Pdf, replacetext.Replace(".pdf", ""));
                }

                if (air3TextBox.Text != "")
                {
                    string replacetext = air3TextBox.Text.Replace("Air 3", "");
                    PDF    air3Pdf     = new PDF(directoryTextBox.Text + "\\" + air3TextBox.Text);
                    air3 = air3Pdf.airExtraction(air3Pdf, replacetext.Replace(".pdf", ""));
                }

                if (air4TextBox.Text != "")
                {
                    string replacetext = air4TextBox.Text.Replace("Air 4", "");
                    PDF    air4Pdf     = new PDF(directoryTextBox.Text + "\\" + air4TextBox.Text);
                    air4 = air4Pdf.airExtraction(air4Pdf, replacetext.Replace(".pdf", ""));
                }

                proessBar.Value = 45;

                //O2 100%
                if (o21001TextBox.Text != "")
                {
                    string replacetext = o21001TextBox.Text.Replace("O2 100% 1", "");
                    PDF    o21001Pdf   = new PDF(directoryTextBox.Text + "\\" + o21001TextBox.Text);
                    o21001 = o21001Pdf.o2100Extraction(o21001Pdf, replacetext.Replace(".pdf", ""));
                }

                if (o21002TextBox.Text != "")
                {
                    string replacetext = o21002TextBox.Text.Replace("O2 100% 2", "");
                    PDF    o21002Pdf   = new PDF(directoryTextBox.Text + "\\" + o21002TextBox.Text);
                    o21002 = o21002Pdf.o2100Extraction(o21002Pdf, replacetext.Replace(".pdf", ""));
                }

                if (o21003TextBox.Text != "")
                {
                    string replacetext = o21003TextBox.Text.Replace("O2 100% 3", "");
                    PDF    o21003Pdf   = new PDF(directoryTextBox.Text + "\\" + o21003TextBox.Text);
                    o21003 = o21003Pdf.o2100Extraction(o21003Pdf, replacetext.Replace(".pdf", ""));
                }

                if (o21004TextBox.Text != "")
                {
                    string replacetext = o21004TextBox.Text.Replace("O2 100% 4", "");
                    PDF    o21004Pdf   = new PDF(directoryTextBox.Text + "\\" + o21004TextBox.Text);
                    o21004 = o21004Pdf.o2100Extraction(o21004Pdf, replacetext.Replace(".pdf", ""));
                }

                proessBar.Value = 50;

                //Fuel
                if (fuel1TextBox.Text != "")
                {
                    string replacetext = fuel1TextBox.Text.Replace("Fuel 1", "");
                    PDF    fuel1Pdf    = new PDF(directoryTextBox.Text + "\\" + fuel1TextBox.Text);
                    fuel1 = fuel1Pdf.fuelExtraction(fuel1Pdf, replacetext.Replace(".pdf", ""));
                }

                if (fuel2TextBox.Text != "")

                {
                    string replacetext = fuel1TextBox.Text.Replace("Fuel 2", "");
                    PDF    fuel2Pdf    = new PDF(directoryTextBox.Text + "\\" + fuel2TextBox.Text);
                    fuel2 = fuel2Pdf.fuelExtraction(fuel2Pdf, replacetext.Replace(".pdf", ""));
                }

                proessBar.Value = 55;


                calSheet.WriteToCalSheet(calSheet.Path, nox500, nox2500, nox10k, no500, no2500,
                                         no10k, thc500, thc2500, thc10k, ch4500, ch42500, ch410k, co5000, coHigh, co2, egr, o225, n21, n22, n23, n24,
                                         air1, air2, air3, air4, o21001, o21002, o21003, o21004, fuel1, fuel2);
                proessBar.Value = 100;

                calSheet.OpenCalSheet(calSheet.Path);
            }
            catch (Exception error)
            {
                System.Windows.MessageBox.Show("There was an error. " + error);
            }
        }