2

私は、python-pptx を使用して PowerPoint を作成する必要があるプロジェクトに取り組んでいます。次のように表示するには、影のあるテキストを追加する必要があります。

ここに画像の説明を入力

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')
4

1 に答える 1

2

バージョン 0.6.7 の時点で、python-pptx にはテキストの影を制御する API がまだありません。

プロジェクトの GitHub イシュー リストの機能リクエストを表示して、コメント (おそらく +1) を追加できます: https://github.com/scanny/python-pptx/issues/130

于 2016-03-01T19:36:54.357 に答える