我正在从 .pptx 打印,但单个句子从某处拆分为新行。这是幻灯片的屏幕截图。
阅读以下代码时.. from pptx import Presentation
prs = Presentation(path_to_presentation)
for slide in prs.slides:
for shape in slide.shapes:
if not shape.has_text_frame:
continue
for paragraph in shape.text_frame.paragraphs:
for run in paragraph.runs:
print(run.text)
获得如下输出...
Books include:
Learning Python
by Mark Lutz
Python Essential Reference
by David Beazley
Python Cookbook
, ed. by Martelli, Ravenscroft and Ascher
(online at http://code.activestate.com/recipes/langs/python/)
http://wiki.python.org/moin/PythonBooks
你可以比较 pptx 的截图和 pptx 的打印文本,项目符号被分成两个或更多的句子..比如“Learning Python by Mark Lutz”打印在 2 点“Learning Python”和“by Mark Lutz”甚至子弹越来越少。
如何解决这个问题?
慕容森
相关分类