all_caps property

Font.all_caps property

True if the font is formatted as all capital letters.

def all_caps(self) -> bool:

def all_caps(self, value: bool):


Shows how to format a run to display its contents in capitals.

doc = aw.Document()
para = doc.get_child(aw.NodeType.PARAGRAPH, 0, True).as_paragraph()

# There are two ways of getting a run to display its lowercase text in uppercase without changing the contents.
# 1 -  Set the "all_caps" flag to display all characters in regular capitals:
run = aw.Run(doc, "all capitals")
run.font.all_caps = True

para = para.parent_node.append_child(aw.Paragraph(doc)).as_paragraph()

# 2 -  Set the "small_caps" flag to display all characters in small capitals:
# If a character is lower case, it will appear in its upper case form
# but will have the same height as the lower case (the font's x-height).
# Characters that were in upper case originally will look the same.
run = aw.Run(doc, "Small Capitals")
run.font.small_caps = True
para.append_child(run) + "Font.caps.docx")

See Also