当前位置: 首页>>代码示例>>Python>>正文


Python Presentation.slide_height方法代码示例

本文整理汇总了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
开发者ID:kmorooka,项目名称:sysmap,代码行数:32,代码来源:sysmap_pptx.py

示例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)
开发者ID:hzhenpeng,项目名称:ReptileSomething,代码行数:8,代码来源:PPTHelper.py

示例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 )
开发者ID:ClayMason,项目名称:BlackrockFBP,代码行数:77,代码来源:req.py


注:本文中的pptx.Presentation.slide_height方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。