-
Notifications
You must be signed in to change notification settings - Fork 546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to toggle bullet point formatting on run or paragraph #100
Comments
This would be very, very useful! Even being to toggle bullets for an entire textbox would be welcome. |
👍 |
+1 Is there anyway to insert a bullet-point text-frame into an existing slide? The only way I can find to create a bullet point text frame is with a new bullet slide layout |
I don't believe there is. There would be two general ways to go about it:
Either one would require some work with internals. If you could manage it, like if you were generating presentations from scratch, the best way might be to create a custom slide layout in your starting template .pptx that was laid out the way you wanted. |
+1 - it would really be awesome to be able - in easy matter - to select the type of bullet. This would complete this really nice python package. Great work ! |
My 2cts, since I have a similar problem domain: How to make a single paragraph not use bullets? I created an example in Powerpoint manually and looked at the XML source. It seems all is needed is the presence of a
This then allows me to do stuff like the following (
In Powerpoint, all paragraphs I add and do I don't know the intricacies of Powerpoint and neither this package/xmlchemy so well as to understand if my "fix" is legitimate or completely brain-dead. I can only see that for the use-case described above, it seems to work (and 2355 tests are still passing). |
@pysailor thanks for the pointer! I've drafted a patch that allows setting a import pptx
prs = pptx.Presentation()
prs.slides.add_slide(prs.slide_layouts[1])
_, body, *_ = prs.slides[0].shapes.placeholders
p = body.text_frame.paragraphs[0]
p.text = "Hello Bullet World" # has a bullet (because of the default style)
prs.save("test1.pptx") # save off a "control" presentation
p.bullet = False # no bullet
prs.save("test2.pptx")
p.bullet = "★" # bullet is star character
prs.save("test3.pptx") |
Any updates on this? |
Um. I'm still intending to put together a proper pull request "when I have time." I fear that ascertainment of exactly how credible my mere "intent" is, must be left to the reader. 😰 😿 ☠️ |
I am having similar need and I used @pysailor 's quick fix to make it work. Only thing is that now the code should be inserted at https://github.com/scanny/python-pptx/blob/master/pptx/oxml/text.py#L462 @pysailor , maybe you can edit your message too as I suspect I am not the only one ending up on this page. Unless there is a better fix now of course, anyway, thanks! |
For anyone that is stuck with a template that forces bullets I figured out a quick workaround that can be used until python-pptx supports shutting off bullets.
I realize it's ugly and I wished I had the time to build the feature properly and provide a pull request, but I don't. |
zackmdavis's solution was great, but I found that sometimes it doesn't work because lacking of buFont(bullet font) element inside the a:pPr @bullet.setter
def bullet(self, value):
pPr = self._p.get_or_add_pPr()
if (
pPr.find(
"a:buFont",
namespaces={
"a": "http://schemas.openxmlformats.org/drawingml/2006/main"
},
)
is None
):
buFont = etree.Element(
"{http://schemas.openxmlformats.org/drawingml/2006/main}buFont",
typeface="Wingdings",
pitchFamily="2",
charset="2",
panose="05000000000000000000",
)
pPr.insert(0, buFont)
pPr.bullet = value |
It would be nice to be able to change the bullet point formatting on a run or paragraph level. I would like to be able to have select text on a slide be bullet pointed while other text not. Also see the google group discussion for a similar request.
https://groups.google.com/d/topic/python-pptx/HhNBrUeqw_w/discussion
The text was updated successfully, but these errors were encountered: