반응형
VB.net 을 사용하여 Excel의 범위에 있는 셀에서 테두리를 제거하는 방법은 무엇입니까?
목표 달성:범위의 셀에 테두리가 있는 경우 테두리를 제거합니다.
다음이 있습니다.
Dim range As Excel.Range = sheet.Range("A2:K100")
For Each cell In range
// Some cells in the Range has borders
// How to remove borders from cells in the range
Next cell
제발 도와주세요..!
저는 Vb.net 에 처음 왔습니다!
range.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Excel.XlLineStyle.xlLineStyleNone
range.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Excel.XlLineStyle.xlLineStyleNone
range.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel.XlLineStyle.xlLineStyleNone
range.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle = Excel.XlLineStyle.xlLineStyleNone
range.Borders(Excel.XlBordersIndex.xlInsideHorizontal).LineStyle = Excel.XlLineStyle.xlLineStyleNone
range.Borders(Excel.XlBordersIndex.xlInsideVertical).LineStyle = Excel.XlLineStyle.xlLineStyleNone
셀 주위 및 셀 사이의 경계를 제거합니다(를 통해).xlInsideHorizontal
그리고.xlInsideVertical
) 대각선 테두리가 예상되는 경우 다음을 포함합니다.xlDiagonalDown
그리고.xlDiagonalUp
.
좋아요, 위의 코드는 매우 장황했습니다.다음과 같은 작업도 수행해야 합니다.
For Each border in range.Borders
border.LineStyle = Excel.XlLineStyle.xlLineStyleNone
Next
참조: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.borders.aspx
편집:
MSDN 페이지를 보면서 이 라이너 하나로도 할 수 있는지 궁금합니다.
range.Borders.LineStyle = Excel.XlLineStyle.xlLineStyleNone
Range("A2:K100").Borders.LineStyle = xlNone
왜 모든 대답들이 그렇게 복잡합니까?
시트 전체에 대해...
With .Cells
.Borders.LineStyle = xlLineStyleNone
End With
범위는 그냥 대체합니다.해당하는 셀
Dim range As Excel.Range = sheet.Range("A2:K100")
range.BorderAround(Excel.XlLineStyle.xlLineStyleNone, Excel.XlBorderWeight.xlThin, Microsoft.Office.Interop.Excel.XlColorIndex.xlColorIndexAutomatic, missing)
환호와 행운을 빕니다!
언급URL : https://stackoverflow.com/questions/6974965/how-to-remove-borders-from-cells-in-a-range-in-excel-using-vb-net
반응형
'code' 카테고리의 다른 글
PowerShell에서 "@" 기호는 무엇을 합니까? (0) | 2023.06.22 |
---|---|
Oracle 오류: ORA-00905:키워드 누락 (0) | 2023.06.17 |
Firestore가 하나의 쿼리를 사용하여 조건에 맞는 여러 문서를 업데이트할 수 있습니까? (0) | 2023.06.17 |
C에서 #error 지시어의 용도는 무엇입니까? (0) | 2023.06.17 |
인쇄 출력의 10진수(R) 수 제어 (0) | 2023.06.17 |