I would like to be able to group tables in PowerPoint, which is something possible by editing the .xml files of slides. I am trying to change the value of
<a:graphicFrameLocks noGrp="1"/>
(here in Table 1
) from 1
to 0
everywhere. So every time it is run, the final result has <a:graphicFrameLocks noGrp="0"/>
everywhere instead of <a:graphicFrameLocks noGrp="1"/>
.
This means that I want to transform this file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
<p:cSld>
<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="1" name=""/>
<p:cNvGrpSpPr/>
<p:nvPr/>
</p:nvGrpSpPr>
<p:grpSpPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="0" cy="0"/>
<a:chOff x="0" y="0"/>
<a:chExt cx="0" cy="0"/>
</a:xfrm>
</p:grpSpPr>
<p:graphicFrame>
<p:nvGraphicFramePr>
<p:cNvPr id="2" name="Table 2">
<a:extLst>
<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
<a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{A3412BCC-6021-5BBE-8391-7BA6964B02B8}"/>
</a:ext>
</a:extLst>
</p:cNvPr>
<p:cNvGraphicFramePr>
<a:graphicFrameLocks noGrp="1"/>
</p:cNvGraphicFramePr>
<p:nvPr>
<p:extLst>
<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}">
<p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2165210174"/>
</p:ext>
</p:extLst>
</p:nvPr>
</p:nvGraphicFramePr>
<p:xfrm>
<a:off x="2434021" y="4345735"/>
<a:ext cx="4064000" cy="370840"/>
</p:xfrm>
<a:graphic>
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
<a:tbl>
<a:tblPr firstRow="1" bandRow="1">
<a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId>
</a:tblPr>
<a:tblGrid>
<a:gridCol w="4064000">
<a:extLst>
<a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}">
<a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/>
</a:ext>
</a:extLst>
</a:gridCol>
</a:tblGrid>
<a:tr h="370840">
<a:tc>
<a:txBody>
<a:bodyPr/>
<a:lstStyle/>
<a:p>
<a:r>
<a:rPr lang="en-US" dirty="0"/>
<a:t>NORMAL</a:t>
</a:r>
</a:p>
</a:txBody>
<a:tcPr/>
</a:tc>
<a:extLst>
<a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}">
<a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/>
</a:ext>
</a:extLst>
</a:tr>
</a:tbl>
</a:graphicData>
</a:graphic>
</p:graphicFrame>
<p:graphicFrame>
<p:nvGraphicFramePr>
<p:cNvPr id="3" name="Table 2">
<a:extLst>
<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
<a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{3C111815-3269-B8CE-F6AA-E05EA0D31543}"/>
</a:ext>
</a:extLst>
</p:cNvPr>
<p:cNvGraphicFramePr>
<a:graphicFrameLocks noGrp="0"/>
</p:cNvGraphicFramePr>
<p:nvPr>
<p:extLst>
<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}">
<p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="205468608"/>
</p:ext>
</p:extLst>
</p:nvPr>
</p:nvGraphicFramePr>
<p:xfrm>
<a:off x="2434021" y="5075929"/>
<a:ext cx="4064000" cy="370840"/>
</p:xfrm>
<a:graphic>
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
<a:tbl>
<a:tblPr firstRow="1" bandRow="1">
<a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId>
</a:tblPr>
<a:tblGrid>
<a:gridCol w="4064000">
<a:extLst>
<a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}">
<a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/>
</a:ext>
</a:extLst>
</a:gridCol>
</a:tblGrid>
<a:tr h="370840">
<a:tc>
<a:txBody>
<a:bodyPr/>
<a:lstStyle/>
<a:p>
<a:r>
<a:rPr lang="en-US" dirty="0"/>
<a:t>GROUPABLE</a:t>
</a:r>
</a:p>
</a:txBody>
<a:tcPr/>
</a:tc>
<a:extLst>
<a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}">
<a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/>
</a:ext>
</a:extLst>
</a:tr>
</a:tbl>
</a:graphicData>
</a:graphic>
</p:graphicFrame>
</p:spTree>
<p:extLst>
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="851650981"/>
</p:ext>
</p:extLst>
</p:cSld>
<p:clrMapOvr>
<a:masterClrMapping/>
</p:clrMapOvr>
</p:sld>
into this file
The second table Table 2
is groupable as intended i.e. <a:graphicFrameLocks noGrp="0"/>
, but I made that manually and obviously I would like to automate this process.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
<p:cSld>
<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="1" name=""/>
<p:cNvGrpSpPr/>
<p:nvPr/>
</p:nvGrpSpPr>
<p:grpSpPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="0" cy="0"/>
<a:chOff x="0" y="0"/>
<a:chExt cx="0" cy="0"/>
</a:xfrm>
</p:grpSpPr>
<p:graphicFrame>
<p:nvGraphicFramePr>
<p:cNvPr id="2" name="Table 2">
<a:extLst>
<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
<a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{A3412BCC-6021-5BBE-8391-7BA6964B02B8}"/>
</a:ext>
</a:extLst>
</p:cNvPr>
<p:cNvGraphicFramePr>
<a:graphicFrameLocks noGrp="0"/>
</p:cNvGraphicFramePr>
<p:nvPr>
<p:extLst>
<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}">
<p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2165210174"/>
</p:ext>
</p:extLst>
</p:nvPr>
</p:nvGraphicFramePr>
<p:xfrm>
<a:off x="2434021" y="4345735"/>
<a:ext cx="4064000" cy="370840"/>
</p:xfrm>
<a:graphic>
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
<a:tbl>
<a:tblPr firstRow="1" bandRow="1">
<a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId>
</a:tblPr>
<a:tblGrid>
<a:gridCol w="4064000">
<a:extLst>
<a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}">
<a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/>
</a:ext>
</a:extLst>
</a:gridCol>
</a:tblGrid>
<a:tr h="370840">
<a:tc>
<a:txBody>
<a:bodyPr/>
<a:lstStyle/>
<a:p>
<a:r>
<a:rPr lang="en-US" dirty="0"/>
<a:t>NORMAL</a:t>
</a:r>
</a:p>
</a:txBody>
<a:tcPr/>
</a:tc>
<a:extLst>
<a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}">
<a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/>
</a:ext>
</a:extLst>
</a:tr>
</a:tbl>
</a:graphicData>
</a:graphic>
</p:graphicFrame>
<p:graphicFrame>
<p:nvGraphicFramePr>
<p:cNvPr id="3" name="Table 2">
<a:extLst>
<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
<a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{3C111815-3269-B8CE-F6AA-E05EA0D31543}"/>
</a:ext>
</a:extLst>
</p:cNvPr>
<p:cNvGraphicFramePr>
<a:graphicFrameLocks noGrp="0"/>
</p:cNvGraphicFramePr>
<p:nvPr>
<p:extLst>
<p:ext uri="{D42A27DB-BD31-4B8C-83A1-F6EECF244321}">
<p14:modId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="205468608"/>
</p:ext>
</p:extLst>
</p:nvPr>
</p:nvGraphicFramePr>
<p:xfrm>
<a:off x="2434021" y="5075929"/>
<a:ext cx="4064000" cy="370840"/>
</p:xfrm>
<a:graphic>
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">
<a:tbl>
<a:tblPr firstRow="1" bandRow="1">
<a:tableStyleId>{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}</a:tableStyleId>
</a:tblPr>
<a:tblGrid>
<a:gridCol w="4064000">
<a:extLst>
<a:ext uri="{9D8B030D-6E8A-4147-A177-3AD203B41FA5}">
<a16:colId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="310984077"/>
</a:ext>
</a:extLst>
</a:gridCol>
</a:tblGrid>
<a:tr h="370840">
<a:tc>
<a:txBody>
<a:bodyPr/>
<a:lstStyle/>
<a:p>
<a:r>
<a:rPr lang="en-US" dirty="0"/>
<a:t>GROUPABLE</a:t>
</a:r>
</a:p>
</a:txBody>
<a:tcPr/>
</a:tc>
<a:extLst>
<a:ext uri="{0D108BD9-81ED-4DB2-BD59-A6C34878D82A}">
<a16:rowId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" val="1744877891"/>
</a:ext>
</a:extLst>
</a:tr>
</a:tbl>
</a:graphicData>
</a:graphic>
</p:graphicFrame>
</p:spTree>
<p:extLst>
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="851650981"/>
</p:ext>
</p:extLst>
</p:cSld>
<p:clrMapOvr>
<a:masterClrMapping/>
</p:clrMapOvr>
</p:sld>
Update 1
I added <xsl:copy>
as I guess otherwise the code would have not given output.
Update 2
I tried also with this code, but I get error it is not well-formed.
Based on this question and its answer, I made the below XSLT, that i ran by launching it from VBA (fixed one previous error with this) and I got:
Error: a reference to variable or parameter 'noGrp' cannot be resolved. The variable or parameter may not be defined, or ir may not be in scope.
I am not very practical with XSLT, the solution may be very simple.
First XSLT I tried
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:safe="http://www.esa.int/safe/sentinel-1.0"
xmlns:ext="http://exslt.org/common" xmlns:p="p" xmlns:a="a"
exclude-result-prefixes="ext p" >
<xsl:template match="/">
<xsl:copy>
<xsl:variable name="graphicFrameLocks" select="//p:sld/p:cSld
[p:spTree[p:nvGrpSpPr[p:grpSpPr[p:graphicFrame[p:nvGraphicFramePr[p:cNvGraphicFramePr[@a:graphicFrameLocks='noGrp']]]]]]]"/>
<xsl:variable name="noGrp">
<xsl:choose>
<xsl:when test="$noGrp">
<xsl:value-of select="1"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="0"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Second XSLT I tried
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
<xsl:for-each select="//a:graphicFrameLocks">
<xsl:if test="@noGrp='1'">
<xsl:attribute name="noGrp">0</xsl:attribute>
</xsl:if>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
Update 3
I was able to change the value, but not through XSLT, so the issue is still open.
Reformulation
I would like to be able to group tables in PowerPoint, which is something possible by editing the .xml files of slides. I am trying to change the value of the attribute noGrp
<a:graphicFrameLocks noGrp="1"/>
(here in Table 1
) from 1
to 0
everywhere. So every time it is run, the final result has <a:graphicFrameLocks noGrp="0"/>
everywhere instead of <a:graphicFrameLocks noGrp="1"/>
when the element is a table <a:tbl>
(I think this is the reason the question looked not clear).
I understood I have to declare the namespaces I find in the .xml of the slide:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
exclude-result-prefixes="a r p">
and going on from there