Files
TZU/py/test.py
2018-04-11 22:17:21 +02:00

71 lines
2.4 KiB
Python

from __future__ import print_function
from openpyxl import Workbook
from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font
wb = Workbook()
wsB1 = wb.active
wsB1.title = "Box 1"
wsB2 = wb.create_sheet("Box 2")
wsGB1 = wb.create_sheet("Graph Box 1")
wsGB2 = wb.create_sheet("Graph Box 2")
cols = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' ]
for sheet in wb:
if sheet.title.startswith("Box"):
print("Schreibe Template in ", sheet.title, "... ", end="")
sheet['A1'] = "Part"
sheet['B1'] = "Length 1"
sheet['C1'] = "Length 2"
sheet['D1'] = "Width 1"
sheet['E1'] = "Width 2"
sheet['F1'] = "Rim1"
sheet['G1'] = "Rim2"
sheet['H1'] = "Rim3"
sheet['I1'] = "Rim4"
sheet['P1'] = "RA lengthwise"
sheet['Q1'] = "RA crosswise"
sheet['R1'] = "Inner dimensions"
sheet['R2'] = "Length"
sheet['T2'] = "Width"
sheet.column_dimensions['A'].width = 6.14 + 0.639
sheet.column_dimensions['B'].width = 7.43 + 0.639
sheet.column_dimensions['C'].width = 7.43 + 0.639
sheet.column_dimensions['D'].width = 6.71 + 0.639
sheet.column_dimensions['E'].width = 6.71 + 0.639
sheet.column_dimensions['F'].width = 4.57 + 0.639
sheet.column_dimensions['G'].width = 4.57 + 0.639
sheet.column_dimensions['H'].width = 4.57 + 0.639
sheet.column_dimensions['I'].width = 4.57 + 0.639
sheet.column_dimensions['J'].width = 3.14 + 0.639
sheet.column_dimensions['K'].width = 3.14 + 0.639
sheet.column_dimensions['L'].width = 3.14 + 0.639
sheet.column_dimensions['M'].width = 3.14 + 0.639
sheet.column_dimensions['N'].width = 3.14 + 0.639
sheet.column_dimensions['O'].width = 3.14 + 0.639
sheet.column_dimensions['P'].width = 12.43 + 0.639
sheet.column_dimensions['Q'].width = 12.43 + 0.639
sheet.column_dimensions['R'].width = 6 + 0.639
sheet.column_dimensions['S'].width = 6 + 0.639
sheet.column_dimensions['T'].width = 6 + 0.639
sheet.column_dimensions['U'].width = 6 + 0.639
sheet.column_dimensions['V'].width = 3 + 0.639
sheet.column_dimensions['W'].width = 3 + 0.639
sheet.column_dimensions['X'].width = 3 + 0.639
sheet.column_dimensions['Y'].width = 3 + 0.639
sheet.column_dimensions['Z'].width = 3 + 0.639
sheet.column_dimensions['AA'].width = 3 + 0.639
for row in range(1, 11):
sheet.row_dimensions[row].height = 13.5
for col in range(1, 27): # A-AA
sheet.cell(row=row, column=col).font = Font(name='Arial', size=10)
print("done")
wb.save('ff.xlsx')