Open 602303068 opened 2 years ago
I can't find the answer to this question either
Color written in the xml. Previewed with the correct color, wrong after open the pptx. Need help, thanks.
Post the minimum reproducible example of the code you used that's not behaving as you expect. https://stackoverflow.com/help/minimal-reproducible-example
Hyperlink color and underline not work, still default blue. hyperlink has no font property. Python version: 3.11.4 python-pptx: 0.6.23
prs = Presentation() blank_slide_layout = prs.slide_layouts[6] slide = prs.slides.add_slide(blank_slide_layout)
txBox = slide.shapes.add_textbox(Inches(1), Inches(1), Inches(8), Inches(1)) tf = txBox.text_frame
p = tf.paragraphs[0] r = p.add_run() r.text = "Test test."
hlink = r.hyperlink hlink.address='http://www.github.com'
font = r.font font.size = Pt(20) font.color.rgb = RGBColor(0, 255, 0) font.underline = False
prs.save('test.pptx')
Hmm, post what you get from print(r.xml)
placed just before prs.save()
and lets have a look at that ...
How do I change the color of hyperlink text? Now add a hyperlink and use color The RGB setting has no effect. It is always the default blue color