http://visualbasic.ittoolbox.com/groups/technical-functional/visualbasic-l/output-onto-excel-1778793
아래는 본문 내용 중 코드 부분.
objApp = new Excel.Application(); objBooks = objApp.Workbooks; objBook = objBooks.Add(Missing.Value); objSheets = objBook.Worksheets; currentRow = 0; Excel.Range range; // populate DataTable function foreach (DataRow dr in function.Rows) { range = objSheet.get_Range("A" + currentRow, "A" + (currentRow+1)); range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; range.Borders.Weight = Excel.XlBorderWeight.xlMedium; range.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; range.MergeCells = true; range.Font.Bold = true; range.Font.Size = 12; range.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.set_Value(Missing.Value, dr["Codice_funzione"]); range.Interior.ColorIndex = 15; range = objSheet.get_Range("B"+currentRow, "K"+ (currentRow+1)); range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; range.Borders.Weight = Excel.XlBorderWeight.xlMedium; range.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; range.MergeCells = true; range.Font.Bold = true; range.Font.Size = 12; range.set_Value(Missing.Value, dr["Descrizione"].ToString().ToUpper()); range.Interior.ColorIndex = 15; range = objSheet.get_Range("L" + currentRow, "M" + (currentRow + 1)); range.Borders.LineStyle = Excel.XlLineStyle.xlContinuous; range.Borders.Weight = Excel.XlBorderWeight.xlMedium; range.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; range.MergeCells = true; range.Font.Bold = true; range.Font.Size = 12; range.set_Value(Missing.Value, dr["Disegno"]); range.Interior.ColorIndex = 15; currentRow += 2; function_components_sensor_list( objSheet, int.Parse(dr["Id_funzione"].ToString()), dr["Codice_funzione"].ToString()); range = objSheet.get_Range("A" + currentRow, "M" + (currentRow + 1)); range.MergeCells = true; currentRow += 2; }
'개발 > .NET' 카테고리의 다른 글
[WCF] Ajax 를 이용한 WCF 호출을 위한 설정. (1) | 2010.10.21 |
---|---|
[WCF] IIS7 에서 404.17 오류가 날 경우 (0) | 2010.10.20 |
[EXCEL] MS-Excel COM 라이브러리를 이용하여 엑셀 출력시 문제 해결. (0) | 2010.09.08 |
[VS2010] Visual Studio 2010 의 Class 템플릿 시그니처 변경하기.... (0) | 2010.09.05 |
[TFS2010] 괜찮은 TFS 확장 관리 툴 (0) | 2010.07.07 |