2016-01-14 54 views
1

我工作的一個項目,我要創建使用python-PPTX一個PowerPoint。我需要補充的是有陰影的文字,出現這樣的:如何在python-pptx中給文本添加陰影?

enter image description here

如何使用Python-PPTX陰影的文本格式?

這裏是我使用的代碼:

from pptx import Presentation 
from pptx.util import Inches, Pt 
from pptx.enum.shapes import MSO_SHAPE 
from pptx.dml.color import RGBColor 
from pptx.enum.dml import MSO_THEME_COLOR 
Temppath ="C:/Rept/Template/Template16.pptx" 
prs= Presentation(Temppath) 
slides =prs.slides[12] 
shapes=slides.shapes 
Month= "October" 
premont="Septmeber" 

for shape in shapes: 
    if shape.has_text_frame: 
     Text_frame=shape.text_frame 
     text=Text_frame.text 
     text= text.split(" ") 
     if "PrevMonth" in text: 
      strText=" ".join(text) 
      strText = strText.replace("PrevMonth",premont) 
      print(strText) 
      p=Text_frame.paragraphs[0] 
      p.clear() 
      run = p.add_run() 
      run.text= strText 
      font= run.font 
      font.color.theme_color = MSO_THEME_COLOR.DARK_2 
      #font.color.rbg=RGBColor(87,24,24) 



prs.save('test3.pptx') 
+0

什麼是你的問題? – scanny

+0

的問題是?有一種方法可以提供像Shadow ext ext這樣的文本格式 –

回答