本文整理汇总了Python中pptx.Presentation.slide_height方法的典型用法代码示例。如果您正苦于以下问题:Python Presentation.slide_height方法的具体用法?Python Presentation.slide_height怎么用?Python Presentation.slide_height使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pptx.Presentation
的用法示例。
在下文中一共展示了Presentation.slide_height方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pptx import Presentation [as 别名]
# 或者: from pptx.Presentation import slide_height [as 别名]
HEADER = "Any["
FOOTER = "]"
SPLITTER = '--- SPLITTER ---' # Must same with sysmap_jl.jl def.
SLIDE_TYPE = 6 # 6: Blank slide. 5: One title slide
TITLE = "Technology System Map" # Only used in slide_title.
print("=== sysmap_pptx: Start.")
if __name__ == "__main__":
prs = Presentation()
#--- Default slide width
prs.slide_width = 9144000
# prs.slide_height = 6858000 # 4:3
prs.slide_height = 5143500 # 16:9
#--- create one blank slide
slide = prs.slides.add_slide(prs.slide_layouts[SLIDE_TYPE])
# if use the following title, set slide 5 instead of 6(blank)
# in the upper code line.
# title = slide.shapes.title
# title.text = 'Technology System Map'
# title.text = TITLE
#--- Set each item to the slide
fn = sys.argv[1] # input position data file.
fd = open(fn, 'r')
fo = sys.argv[2]
# print "fn : %s" % fn
示例2: ppt_existed
# 需要导入模块: from pptx import Presentation [as 别名]
# 或者: from pptx.Presentation import slide_height [as 别名]
def ppt_existed(ppt_name):
if not os.path.exists(ppt_name):
prs = Presentation()
prs.slide_height = cm_to_in(14.35)
prs.slide_width = cm_to_in(25.5)
prs.save(ppt_name)
示例3: pres
# 需要导入模块: from pptx import Presentation [as 别名]
# 或者: from pptx.Presentation import slide_height [as 别名]
def pres(data, name, directory):
pres = Presentation()
# Set slide dimentions
pres.slide_width = 6858000
pres.slide_height = 9144000
# Get title slide
title_layout = pres.slide_layouts[0]
# Get first slide
title_slide = pres.slides.add_slide( title_layout )
title = title_slide.shapes.title
title.text = name
# Make each page
for page in range( 0, math.ceil( len(data)/4 ) ):
# Make slide
page_layout = pres.slide_layouts[1]
slide = pres.slides.add_slide( page_layout )
# Get shape
shape = slide.shapes
for order in range(0, 4):
position = (page * 4) + (order)
# Make sure it is in the data
if not position > (len(data) - 1):
# Make sure in range of data list
# Get positions
left = Inches(3)
width = Inches(5)
height = Inches(2)
# Get top Position
if order == 0:
top_inches = 1
top_par = 1.2
else:
top_inches = (order * 2) + 1
top_par = 1.2
top = Inches( top_inches )
top_paragraph = Inches( top_par )
# Create Image
if 'image' in data[position]:
image_path = str(directory) + '/Photos/' + str(data[position]['image'])
image_left = Inches(1)
pic = shape.add_picture(image_path, image_left, top)
# Textbox
txBox = shape.add_textbox(left, top, width, height)
txBox2 = shape.add_textbox(left, top_paragraph, width, height)
name = txBox.text_frame
name.text = str( data[position]['first_name'] ) + ' ' + str( data[position]['last_name'] )
content = txBox2.text_frame
if 'questions' in data[position]:
content.text = 'University: {0} \nInterest: {1} \nFavorite Film: {2} \nDinner Invites: {3}'.format( str(data[position]['university']), str(data[position]['questions']), str(data[position]['questions']), str(data[position]['questions']) )
else:
content.text = ''
# Save presentation
pres_name = str(name) + '.pptx'
pres.save( pres_name )