0
Excel Interop에서 Range.Autofilter()
을 설정 한 후 첫 번째 행을 제외한 모든 보이는 행을 삭제해야합니다. 첫 번째 행은 시트의 제목 행입니다. 감사합니다. .제목 행을 제외하고 자동 필터 다음에 보이는 행을 삭제하는 방법은 무엇입니까?
Excel Interop에서 Range.Autofilter()
을 설정 한 후 첫 번째 행을 제외한 모든 보이는 행을 삭제해야합니다. 첫 번째 행은 시트의 제목 행입니다. 감사합니다. .제목 행을 제외하고 자동 필터 다음에 보이는 행을 삭제하는 방법은 무엇입니까?
Excel.Application objexcel = new Microsoft.Office.Interop.Excel.Application();
Excel.Workbook xlBook = objexcel.Workbooks.Open(filename);
Excel.Worksheet xlSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlBook.Worksheets.get_Item(1);
range = xlSheet.UsedRange;
Excel.Range last =xlSheet.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
range.get_Range("A2", last).Delete(XlDeleteShiftDirection.xlShiftUp);
이것은 효과가 있습니다.