// - 아래 사용 암호. 약간의 변경과 함께 단일 시트에 대한 루프를 제거하십시오.
// 경로했다 엑셀 파일이 유지
문자열 ResultsFilePath = @ "C : \ 사용자 \ krakhil \ 바탕 화면 \ TGUW EXCEL \ TEST";
Excel.Application ExcelApp = new Excel.Application();
Excel.Workbook ExcelWorkbook = ExcelApp.Workbooks.Open(ResultsFilePath);
ExcelApp.Visible = true;
//Looping through all available sheets
foreach (Excel.Worksheet ExcelWorksheet in ExcelWorkbook.Sheets)
{
//Selecting the worksheet where we want to perform action
ExcelWorksheet.Select(Type.Missing);
ExcelWorksheet.Columns[1].NumberFormat = "@";
}
//saving excel file using Interop
ExcelWorkbook.Save();
//closing file and releasing resources
ExcelWorkbook.Close(Type.Missing, Type.Missing, Type.Missing);
Marshal.FinalReleaseComObject(ExcelWorkbook);
ExcelApp.Quit();
Marshal.FinalReleaseComObject(ExcelApp);
참조하십시오이 답변 http://stackoverflow.com/questions/2067926/format-an-excel-column-or-cell-as-text-in-c – katit
@Katit : 질문 경기 동안 , 제 3 자 라이브러리에 의존하지 않기 때문에 여기에 대한 대답은 IMHO가 더 좋습니다. –
그래, 그 통지하지 않았다 – katit