■ 엑셀 시트 내 모든 셀 값 지우기

----------------------------------------------------------------------------------------------------

using Excel = Microsoft.Office.Interop.Excel;

 

#region 셀 값들 지우기 - ClearCellValues(worksheet)

 

/// <summary>

/// 셀 값들 지우기

/// </summary>

/// <param name="worksheet">워크시트</param>

public void ClearCellValues(Excel.Worksheet worksheet)

{

    Excel.Range startRange = worksheet.Cells[1                   , 1                      ] as Excel.Range;

    Excel.Range endRange   = worksheet.Cells[worksheet.Rows.Count, worksheet.Columns.Count] as Excel.Range;

 

    worksheet.Range[startRange, endRange].Clear();

}

 

#endregion

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG