저는 실제로 여기에 python win32com을 사용하여 Excel의 테두리를 포맷하는 코드 조각을 가지고 있습니다. 내 관심은 국경을 포맷하는 데 걸리는 시간입니다. 필자는 스크립트에서 매크로를 조 변경하는 데 필요한 정보를 찾기 위해 Excel에 매크로를 기록하려고 시도했지만 작동하지 않았습니다.python win32com excel border formatting
그래서 내가 할 수있는 최선의 방법은 항상 행 3에서 1 행 단위로 시작하고 1 행 단위로 1 행 단위로, 1 열 단위로 10 행 단위로 시작하는 범위 루프에서 실행하는 것입니다 거기에서 "BorderAround()"잘 작동하지만 너무 느린 사용합니다. 여기에 코드를 내 조각 :
for shn in [("Beam-Beam", bb_row, bb_col), ("Beam-Col", bc_row, bc_col)]:
sheet = book.Worksheets(shn[0])
sheet.Range("J3:DW3").Copy()
if shn[0] == "Beam-Col":
sheet.Range("J3:AA3").Copy()
sheet.Range(sheet.Cells(4, 10), sheet.Cells(shn[1]-1, 10) ).PasteSpecial()
for mrow in xrange(3,shn[1],1):
for mcol in xrange(1,10,1):
sheet.Cells(mrow, mcol).BorderAround()#.Border(1)
내가 ==> sheet.Range (sheet.Cells 같은 범위 (3,1)으로 경계를 포맷 할 수있는 일이 있는가, sheet.Cells (SHN [1 ], 10))? ".Borders (11)"과 ".Borders (12)"와 ".BorderAround()"를 시도했지만 ".BorderAround()"만 작동했습니다.
미리 감사드립니다.