Сделай мне на подобие только пустой чтоб я мог его...
बनाया गया: 24 दिसंबर 2025
का उपयोग करके उत्तर दिया गया GPT-5.2 Thinking द्वारा Chat01
बनाया गया: 24 दिसंबर 2025
का उपयोग करके उत्तर दिया गया GPT-5.2 Thinking द्वारा Chat01
pythonfrom docx import Document from docx.shared import Pt, Cm from docx.enum.text import WD_ALIGN_PARAGRAPH from docx.oxml import OxmlElement from docx.oxml.ns import qn def set_normal_style(doc, font_name="Times New Roman", font_size=Pt(14)): style = doc.styles['Normal'] font = style.font font.name = font_name font.size = font_size # Ensure East Asian font too rPr = style.element.rPr if rPr is None: rPr = OxmlElement('w:rPr') style.element.append(rPr) rFonts = rPr.find(qn('w:rFonts')) if rFonts is None: rFonts = OxmlElement('w:rFonts') rPr.append(rFonts) rFonts.set(qn('w:ascii'), font_name) rFonts.set(qn('w:hAnsi'), font_name) rFonts.set(qn('w:eastAsia'), font_name) rFonts.set(qn('w:cs'), font_name) def set_margins(section, left_cm=3.0, right_cm=1.5, top_cm=2.0, bottom_cm=2.0): section.left_margin = Cm(left_cm) section.right_margin = Cm(right_cm) section.top_margin = Cm(top_cm) section.bottom_margin = Cm(bottom_cm) def remove_table_borders(table): tbl = table._tbl tblPr = tbl.tblPr if tblPr is None: tblPr = OxmlElement('w:tblPr') tbl.insert(0, tblPr) tblBorders = OxmlElement('w:tblBorders') for edge in ('top','left','bottom','right','insideH','insideV'): elem = OxmlElement(f'w:{edge}') elem.set(qn('w:val'), 'nil') tblBorders.append(elem) tblPr.append(tblBorders) doc = Document() set_normal_style(doc) section = doc.sections[0] set_margins(section) # Header block header_lines = [ "Генеральному директору", "ООО «____________________»", "______________________________", "от ____________________________", "_______________________________", ] for line in header_lines: p = doc.add_paragraph(line) p.alignment = WD_ALIGN_PARAGRAPH.RIGHT p.paragraph_format.space_after = Pt(0) # add a line for applicant name maybe p = doc.add_paragraph("______________________________") p.alignment = WD_ALIGN_PARAGRAPH.RIGHT p.paragraph_format.space_before = Pt(0) p.paragraph_format.space_after = Pt(12) # Title title = doc.add_paragraph() title_run = title.add_run("ЗАЯВЛЕНИЕ") title_run.bold = True title.alignment = WD_ALIGN_PARAGRAPH.CENTER title.paragraph_format.space_before = Pt(12) title.paragraph_format.space_after = Pt(12) # Body body_text = ("В связи с выходом на пенсию на основании ч. 3 ст. 80 Трудового кодекса РФ прошу " "уволить меня с занимаемой должности по собственному желанию «___» __________ 20__ г.") body = doc.add_paragraph(body_text) body.alignment = WD_ALIGN_PARAGRAPH.JUSTIFY body.paragraph_format.first_line_indent = Cm(1.25) body.paragraph_format.space_after = Pt(18) body.paragraph_format.line_spacing = 1.5 # Signature/date table table = doc.add_table(rows=2, cols=2) remove_table_borders(table) table.autofit = True # Row 1 signature cell_left = table.cell(0,0) cell_right = table.cell(0,1) cell_left.paragraphs[0].add_run("______________________") cell_right.paragraphs[0].add_run("/ ______________________") cell_left.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.RIGHT cell_right.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.LEFT # Row 2 date merged merge_cell = table.cell(1,0).merge(table.cell(1,1)) merge_p = merge_cell.paragraphs[0] merge_p.add_run("«___» __________ 20__ г.") merge_p.alignment = WD_ALIGN_PARAGRAPH.LEFT # spacing before table doc.paragraphs[-2].paragraph_format.space_after = Pt(0) out_path = "/mnt/data/Шаблон_заявление_увольнение_на_пенсию.docx" doc.save(out_path) out_path '/mnt/data/Шаблон_заявление_увольнение_на_пенсию.docx'
Готово — сделал пустой шаблон “как на примере” и сохранил в Word.