Skip to content

How to change style of hyperlinks in existing document? #1066

Closed
@a-peace

Description

@a-peace

Especially font size and name, maybe even for all content in document.

Currently i'm using this snippet for changing style in document, but links are no affected. Should I recreate them?

from docx import Document
from docx.shared import Pt

document = Document("existing file.docx")

for paragraph in document.paragraphs:
    # paragraph.style = document.styles['Normal']
    for run in paragraph.runs:
        run.font.name = 'Arial'
        run.font.size = Pt(10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions