PPTX.jl icon indicating copy to clipboard operation
PPTX.jl copied to clipboard

Support for grouped shapes

Open DrChainsaw opened this issue 11 months ago • 4 comments

Are there any plans to support grouped shapes?

When using python-pptx I have found them quite useful for layout purposes when generating slides with more than one shape as one can just change the size of the group to fit the slide and let power point handle where things end up as a result (or at least I hope it is power point that does this and not python-pptx).

DrChainsaw avatar Mar 16 '24 11:03 DrChainsaw

We'd have to check how python-pptx does this, but my first guess is that the python code is doing the layouting.

If our PPTX code should handle the layouting, we could look into adding an interface like Makie's gridlayout, which I think is available in GridLayoutBase.jl. Or we define our own layout mechanism.

I guess we would turn the slide into a layout or something? Very naively:

s = Slide()
layout = SlideLayout(s) # or push! the layout into the slide?
layout[1,1] = Picture("figure.png")
layout[1,2] = TextBox("see the nice picture on the left")

matthijscox-asml avatar Jul 16 '24 06:07 matthijscox-asml

Having a generic layout mechanism would be awesome. I would probably prefer if it acted like just another shape you could put anywhere on the slide.

I think the support for groups is a bit of an orthogonal issue which maybe could be useful even if the above becomes a reality (e.g w.r.t manual post-generation editing).

If you have the possibility to review/accept PRs I can try to look into both of these and see what I can come up with. The fact that GridLayoutBase does not have any documentation is a bit daunting, but maybe the makie docs are sufficient.

DrChainsaw avatar Jul 16 '24 10:07 DrChainsaw

Feel free to experiment on a fork and open a PR when you have something useful.

Did I interpret your request for groups in the wrong way? I thought it was equivalent to such a layout mechanism?

matthijscox-asml avatar Jul 16 '24 11:07 matthijscox-asml

Awesome. I'll open a PR as soon as I have something to not block/discourage others from trying in case I get stalled somehow.

I think that groups can help with a subset of the layouting (scaling the size of all shapes in the group while retaining their relative position to each other), but the layout mechanisms for a plotting library are going to be much more powerful and easy to work with.

They might still be useful for the sole purpose that someone might want to programmatically create a group though.

DrChainsaw avatar Jul 16 '24 11:07 DrChainsaw