I am trying to retrieve the slide number between the 'a:t' tags when type = "slidenum" using the following code but something is not working. I'm supposed to get 1.
Here's the XML:
<a:p><a:fld id="{55FBEE69-CA5C-45C8-BA74-481781281731}" type="slidenum">
<a:rPr lang="en-US" sz="1300" i="0"><a:solidFill><a:srgbClr val="000000"/>
</a:solidFill></a:rPr><a:pPr/><a:t>1</a:t></a:fld><a:endParaRPr lang="en-US"
sz="1300" i="0"><a:solidFill><a:srgbClr val="000000"/></a:solidFill>
</a:endParaRPr></a:p></p:txBody></p:sp>
Here's my code
z = zipfile.ZipFile(pptx_filename)
for name in z.namelist():
m = re.match(r'ppt/notesSlides/notesSlide\d+\.xml', name)
if m is not None:
f = z.open(name)
tree = ET.parse(f)
f.close()
root = tree.getroot()
# Find the slide number.
slide_num = None
for fld in root.findall('/'.join(['.', '', p.txBody, a.p, a.fld])):
if fld.get('type', '') == 'slidenum':
slide_num = int(fld.find(a.t).text)
print slide_num