scanny / python-pptx

Create Open XML PowerPoint documents in Python
MIT License
2.38k stars 514 forks source link

status of the project? support for shape shadows? #705

Open nnako opened 3 years ago

nnako commented 3 years ago

Hi,

I think, PYTHON PPTX is a great project. and, without having read all the open issues, I would like to ask wheteher the project is still under active development. the last changes to the code base have been made about two years ago. if this was the case, can anybody tell me if there were plans to continue with the development of this really important project?

Another more technical question: I miss the support for shadows of shapes. until now, I was not able to activate shape shadows for my own text-based shapes and even could not find any successful post about this feature within all the forum platforms I know. the official documentation sounds kind of half-way interrupted, though.

I looked inside the PPTX file and analyzed the structural differences for a single text shape with and without some basic shadow settings. It is just this small snippet of XML code within ppt/slides/slide1.xml:

<a:effectLst>
    <a:outerShdw blurRad="50800" dist="38100" dir="2700000" algn="tl" rotWithShape="0">
        <a:prstClr val="black">
            <a:alpha val="40000"/>
        </a:prstClr>
    </a:outerShdw>
</a:effectLst>

So, I was thinking of implementing it myself, as I have some experience with XML parsing and Python in general. and then contributing it back into this code base. but, I need your help:

Is there some information about the concept of how features are implemented within this project? e.g. how is the project's normal operation and development flow? I could imagine something like this: (1) read in the original PPTX into memory. (2) use XML-tools to parse and manipulate the XML structures directly. (3) update all the possible cross-references within the XML-structure in order not to confuse PowerPoint or the open / libre office applications. (4) write back the PPTX file.

Is there some information for developers besides the pure source code?

Thanks.

MartinPacker commented 3 years ago

From my (MIT) Open Source project (md2pptx):

# Add a drop shadow to a shape
def createShadow(shape):
    spPr = shape.fill._xPr

    el = OxmlElement("a:effectLst")
    spPr.append(el)

    outerShdw = OxmlElement("a:outerShdw")
    outerShdw.set("algn", "tl")
    outerShdw.set("blurRad", "50800")
    outerShdw.set("dir", "2700000")
    outerShdw.set("dist", "95250")
    outerShdw.set("rotWithShape", "0")

    el.append(outerShdw)

    prstClr = OxmlElement("a:prstClr")
    prstClr.set("val", "black")

    outerShdw.append(prstClr)

    alpha = OxmlElement("a:alpha")
    alpha.set("val", "40000")

    prstClr.append(alpha)
bsherwin commented 3 years ago

@nnako ... it looks like the rc branch was updated just a month ago...so @scanny is probably still active on it.

hawkEye-01 commented 2 years ago

Hi, in order to add shadow to text in shape i need to add outerShdw element to (according to slide xml). since i don't know xml i really need your help. @bsherwin . Thanks

MartinPacker commented 2 years ago

@hawkEye-01 see my code snippet above.