So ändern Sie die Schriftgröße von Text in einer von Python-pptx erstellten Tabelle
Ich erstelle ein Skript, um Diagramme der Produktleistung anzuzeigen, und erstelle eine Tabelle, um die Teilenummer, eine Liste der Anwendungen und die Anzahl der aktuellen Anwendungen anzuzeigen.
Die Standardschriftgröße ist jedoch viel zu groß, um all diese Informationen in die Folie aufzunehmen, und muss reduziert werden.
Wie kann ich die Schriftgröße von Text in einer Tabelle in Python-pptx verringern?
Das ist, was ich habe, aber ich erhalte immer wieder eine Fehlermeldung "AttributeError: '_Cell' Objekt hat kein Attribut 'Absatz'"
table = shapes.add_table(rows, cols, left + left_offset, top + Inches(.25), width, height - Inches(.25)).table
#column width
for i in range(3):
table.columns[i].width = col_width[i]
for i in range(len(a_slide)):
#color table
if i % 2 == 0:
for j in range(3):
fill = table.cell(i, j).fill
fill.background()
else:
for j in range(3):
fill = table.cell(i, j).fill
fill.solid()
fill.fore_color.rgb = RGBColor(240, 128, 128)
#populate table
table.cell(i, 0).text = str(item["name"])
try:
table.cell(i, 1).text = ", ".join(item["app"])
except:
table.cell(i, 1).text = " "
finally:
table.cell(i, 2).text = str(item["vio"])
for j in range(0,3):
font = table.cell(i, j).paragraph[0].font
font.size = Pt(12)