I’m trying to make a list of fonts used in a presentation however I seem to miss a lot of fonts. Any idea what I’m missing please?
fontsinpres = []
self.presentation = slides.Presentation("input.pptx")
for sld in self.presentation.slides:
for shp in sld.shapes:
if type(shp) is slides.GroupShape:
for j in range(len(shp.shapes)):
try:
fontname = shp.shapes[j].text_frame.paragraphs[0].portions[0].portion_format.latin_font
if fontname != None or '':
if fontname not in fontsinpres:
fontsinpres.append(fontname)
except:
pass
elif type(shp) is slides.Table:
tbl = shp
for row in range(len(tbl.rows)):
for cell in range(len(tbl.rows[row])):
try:
fontname = cell.text_frame.paragraphs[0].portions[0].portion_format.latin_font
if fontname != None or '':
if fontname not in fontsinpres:
fontsinpres.append(fontname)
except:
pass
else:
try:
fontname = sld.shp.text_frame.paragraphs[0].portions[0].portion_format.latin_font
if fontname != None or '':
if fontname not in fontsinpres:
fontsinpres.append(fontname)
except:
pass