更改Excel文件中的单元格值,并使用c#将更改复制到新列

我需要减less列中的单元格值,如“250-1824-02”到“250-1824”,并使用c#将新值更新到同一个Excel表中的新列。 请帮忙

我已经生成了以下级别的编码:

Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlApp.Visible = false; xlWorkBook = xlApp.Workbooks.Open(textBox1.Text, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); 

 Excel.Application xlApp; Excel.Workbook xlWorkBook; Excel.Worksheet xlWorkSheet; object misValue = System.Reflection.Missing.Value; xlApp = new Excel.Application(); xlWorkBook = xlApp.Workbooks.Open(ExcelFile, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue); xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); Microsoft.Office.Interop.Excel.Range range = xlWorkSheet.Cells.SpecialCells( Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell, Type.Missing); string value = string.Empty; for (int Loop = 1; Loop <= range.Row; Loop++) { value = Convert.ToString(xlWorkSheet.Range["A" + Loop, "A" + Loop].get_Value(misValue)); xlWorkSheet.Range["B" + Loop, "B" + Loop].set_Value(misValue, value.Remove(8, 3)); }