private void Write_item(ListItem item)
        {
            xl.Switch_to_R1C1();

            xl.Cell_value(qs.lastRow, qs.quantityCol, item.Quantity);
            xl.Cell_value(qs.lastRow, qs.descriptionCol, item.Description);
            xl.Cell_value(qs.lastRow, qs.serviceCol, item.Service);
            xl.Cell_value(qs.lastRow, qs.materialCol, item.Material);
            xl.Cell_value(qs.lastRow, qs.sizeCol, item.Size);
            xl.Cell_value(qs.lastRow, qs.ratingCol, item.Rating);
            xl.Cell_value(qs.lastRow, qs.lengthCol, item.Length);

            xl.Cell_value(qs.lastRow, qs.aCol, item.A);
            xl.Cell_value(qs.lastRow, qs.bCol, item.B);
            xl.Cell_value(qs.lastRow, qs.cCol, item.C);
            xl.Cell_value(qs.lastRow, qs.unitsCol, item.Units);
            xl.Cell_value(qs.lastRow, qs.partNumCol, item.PartNumber);
            xl.Cell_value(qs.lastRow, qs.partPriceCol, item.PriceEach);
            xl.Cell_value(qs.lastRow, qs.materialPriceCol, item.PriceTotal);

            xl.Cell_value(qs.lastRow, qs.plasmaLaborCol, item.PlasmaLabor);
            xl.Cell_value(qs.lastRow, qs.rollerLaborCol, item.RollingLabor);
            xl.Cell_value(qs.lastRow, qs.subarcLaborCol, item.SubarcLabor);
            xl.Cell_value(qs.lastRow, qs.cuttingLaborCol, item.CuttingLabor);
            xl.Cell_value(qs.lastRow, qs.blastLaborCol, item.BlastLabor);
            xl.Cell_value(qs.lastRow, qs.welderLaborCol, item.WelderLabor);
            xl.Cell_value(qs.lastRow, qs.hoursCol, item.Hours);

            xl.Switch_to_A1();

            if (item.Description == "SECTION A") qs.sectionARow = qs.lastRow;
            if (item.Description == "SECTION B") qs.sectionBRow = qs.lastRow;
            qs.lastRow++;  
        }
        private void Write_subtotal_block()
        {
            xl.Cell_value(2, 5, "MATERIALS SUBTOTAL:");
            xl.Cell_value(3, 5, "MATERIALS TOTAL:");
            xl.Cell_value(4, 5, "HOURS COUNT:");
            xl.Cell_value(5, 5, "HOURLY RATE:");
            xl.Cell_value(6, 5, "LABOR TOTAL:");
            xl.Cell_value(7, 5, "COST TOTAL:");

            //switch to "R1C1" mode to make formulas easier to code
            xl.Switch_to_R1C1();

            //materials subtotal formula
            Relative_rows_and_columns(2, 6);
            //"=SUMPRODUCT(QTY COLUMN, MATERIAL $/EA COLUMN)"
            formula = "=SUMPRODUCT(R[" + relFirstRow + "]C[" + relQuantityCol + "]:R[" + relLastRow + "]C[" + relQuantityCol + "], " +
                      "R[" + relFirstRow + "]C[" + relMaterialPriceCol + "]:R[" + relLastRow + "]C[" + relMaterialPriceCol + "])";
            xl.Cell_value(2, 6, formula);

            //materials total formula
            formula = "=R[-1]C*1.064"; //materials total = materials subtotal x freight multiplier
            xl.Cell_value(3, 6, formula);

            //hours count formula
            Relative_rows_and_columns(4, 6);
            //"=CEILING.MATH(SUMPRODUCT(QTY COLUMN, MATERIAL $/EA COLUMN), 0.125)"
            formula = "=CEILING.MATH(SUMPRODUCT(R[" + relFirstRow + "]C[" + relQuantityCol + "]:R[" + relLastRow + "]C[" + relQuantityCol + "], " +
                      "R[" + relFirstRow + "]C[" + relHoursCol + "]:R[" + relLastRow + "]C[" + relHoursCol + "]), 0.05)";
            xl.Cell_value(4, 6, formula);

            //hourly rate
            xl.Cell_value(5, 6, hourlyRate);

            //labor total formula
            formula = "=R[-2]C*R[-1]C"; //labor total = hours count x hourly rate
            xl.Cell_value(6, 6, formula);

            //cost total formula
            formula = "=R[-4]C+R[-1]C"; //cost total = materials total + labor total
            xl.Cell_value(7, 6, formula);

            //switch back to "A1" mode to make worksheet easier to read
            xl.Switch_to_A1();
        }