In which way are these two PowerPoint Shapes different (accessed via API)
<p>As part of an open source assistive technology project (<a href="https://hackaday.io/project/15567-the-open-voice-factory" rel="nofollow">here</a>), I am accessing a PowerPoint file by python API (<a href="https://python-pptx.readthedocs.io/en/latest/" rel="nofollow">python-pptx</a>).   </p>

<p>Some shapes are causing exceptions when I look at color. But it's hard to see which.  </p>

<p>I've created this minimal example: <a href="https://www.dropbox.com/s/o5z22lqwb66jemq/forUpload.pptx?dl=0" rel="nofollow">https://www.dropbox.com/s/o5z22lqwb66jemq/forUpload.pptx?dl=0</a> </p>

<p>and indeed, here's a screenshot: </p>

<p><a href="http://i.stack.imgur.com/w3k75.png" rel="nofollow"><img src="http://i.stack.imgur.com/w3k75.png" alt="enter image description here"></a></p>

<p>It consists of a single slide, with shapes that work on the left, and shapes that fail on the right. Using the format painter will make a shape work (or not, depending on the source of the formatting) but I've been through every way of checking the formats that I can think of, and both sets of shapes appear identical. </p>

<p>How are the two sets of shapes in the minimal example different?</p>

<p>(for those who might be interested from a API point of view.  The line that causes the problem is: </p>

<pre><code>self.colours[co][ro] = shape.fill.fore_colour.rgb
</code></pre>

<p>which is in <a href="https://github.com/joereddington/TheOpenVoiceFactory/blob/master/grab_text.py" rel="nofollow">https://github.com/joereddington/TheOpenVoiceFactory/blob/master/grab_text.py</a></p>

<p>and the exception is:</p>

<pre><code>Traceback (most recent call last):   File "grab_text.py", line 374, in &lt;module&gt;
    grids = extract_grid(prs)   File "grab_text.py", line 353, in extract_grid
    grids.append(Grid(prs, slide, gridSize))   File "grab_text.py", line 119, in __init__
    self.process_shape(shape)   File "grab_text.py", line 164, in process_shape
    ro] = shape.fill.fore_color.rgb   File "/Library/Python/2.7/site-packages/pptx/dml/fill.py", line 43, in fore_color
    return self._fill.fore_color   File "/Library/Python/2.7/site-packages/pptx/dml/fill.py", line 161, in fore_color
    raise TypeError(tmpl) TypeError: a transparent (background) fill has no foreground color
</code></pre>

<p>)</p>

<p>You need to call:</p>

<pre><code>shape.fill.solid()
</code></pre>

<p>before attempting to access the <code>fore_color</code> attribute.</p>

<p>A fill can have several types, each of which have a different attribute set. The <code>.fore_color</code> attribute is particular to a solid fill. By default, the fill is transparent (i.e. None).</p>

<p>A little more about it in the documentation here:
<a href="http://python-pptx.readthedocs.io/en/latest/user/autoshapes.html#fill" rel="nofollow">http://python-pptx.readthedocs.io/en/latest/user/autoshapes.html#fill</a></p>

python powerpoint