精华内容
下载资源
问答
  • 代码生成PPT(C#)

    2021-02-14 20:30:18
    采用C#代码自动实现PPT,包括对文字、图片、图表的生成。 采用C#代码自动实现PPT,包括对文字、图片、图表的生成
  • 生成ppt
  • 目标代码生成..ppt

    2020-11-05 00:14:16
    目标代码生成..ppt
  • java实现poi模板生成PPT文件代码:两个迭代版本。java实现poi模板生成PPT文件代码:两个迭代版本。
  • 第七章 代码生成.ppt

    2020-03-21 10:43:47
    c 该选项在g++的汇编器生成指定源文件的目标代码之后停止继续编译也就是说这一选项告诉g++只把源代码.cpp文件)编译成目标代码.o文件就完成任务了如果没有这个选项则g++将合并库文件和目标代码文件最终生成可执行文件...
  • 第9章 目标代码生成 目标代码生成是把语法分析优化后的中间代码变换成目标代码目标代码的形式主要包括如下3种形式 1具有绝对地址的机器语言程序能立即执行的机器语言代码主程序与子程序需要同时编译 2可浮动的机器...
  • 第十一章 目标代码生成;词法分析器;内容线索;代码生成;目标代码生成;基本问题;基本问题 ;基本问题 ;内容线索;目标机器模型 ;如果op是一目运行符则op Ri, M的意义为opM? Ri其余类型可类推;op 包括一般计算机上常见的...
  • 中间的代码生成.ppt

    2020-11-21 09:45:10
    LL(1)与递归子程序法的联系 都是在扫描过程中进行产生式的推导同时在适当的地方加入语义动作 递归子程序法将语义动作溶入分析程序LL(1)分析法则由语义子程序完成相应的翻译 递归子程序法隐式地使用语义栈 LL(1)分析...
  • 回填和非回填方法的比较1 B ? {B1.true=B.true, B1.false = newlabel;...} B2 true/false属性的赋值在回填方案中对应为相应的list的赋值或者merge 原来生成label的地方在回填方案中使用M来记录相应的代码位置M.inst的需
  • J面向对象模型及代码生成技术精品.ppt
  • 第12章 代码生成;12.1 目标机(R(addr(A) ?R ;Real(addr[A]?R ;Addr[A]?R ;则生成四元式为(当前层数l-1: 1(FUNC,f, Noff,Moff) 2(CONV,J, , T1 ) 3(r+, 2.5, T1, T2 ) 2.5+J 4(=, T2, , X ) X:=2.5+J 5, X, 2.5, T3 )...
  • 第五章 语法制导翻译与中间代码生成;第五章 语法制导翻译与中间代码生成;第五章 语法制导翻译与中间代码生成;第五章 语法制导翻译与中间代码生成;第五章 语法制导翻译与中间代码生成;第五章 语法制导翻译与中间代码...
  • 本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt环境python 3python-pptx安装 pip3 install python-pptx将文字输出到ppt效果图 代码 from pptx import Presentation# 创建幻灯片 ------prs = ...

    本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt

    环境

    python 3

    python-pptx

    安装 pip3 install python-pptx

    将文字输出到ppt

    效果图

    41206926a62a306ab0f612128308cb45.png

    代码 from pptx import Presentation

    # 创建幻灯片 ------

    prs = Presentation()

    title_slide_layout = prs.slide_layouts[0]

    slide = prs.slides.add_slide(title_slide_layout)

    title = slide.shapes.title

    subtitle = slide.placeholders[1]

    # 设置标题和副标题

    title.text = "Hello, World!"

    subtitle.text = "pip install python-pptx"

    prs.save("test.pptx")

    图表输出到ppt

    效果图

    f1b869710eed050f09fa99126814a907.png

    代码 from pptx import Presentation

    from pptx.chart.data import ChartData

    from pptx.enum.chart import XL_CHART_TYPE

    from pptx.util import Inches

    # 创建幻灯片 ------

    prs = Presentation()

    slide = prs.slides.add_slide(prs.slide_layouts[5])

    # 定义图表数据 ---------------------

    chart_data = ChartData()

    chart_data.categories = ['East', 'West', 'Midwest']

    chart_data.add_series('Series 1', (19.2, 21.4, 16.7))

    # 将图表添加到幻灯片 --------------------

    x, y, cx, cy = Inches(2), Inches(2), Inches(6), Inches(4.5)

    slide.shapes.add_chart(

    XL_CHART_TYPE.COLUMN_CLUSTERED, x, y, cx, cy, chart_data

    )

    prs.save('chart-01.pptx')

    使用ppt模板来生成ppt 准备ppt模板(网络下载或自定义幻灯片母版) 加载ppt模板,并使用指定幻灯片样式 添加数据并生成新ppt

    效果图

    83cb0b7e22ae075e8883583d04d89d2d.png

    代码 from pptx import Presentation

    from pptx.util import Inches

    from pptx import Presentation

    from pptx.chart.data import ChartData

    from pptx.enum.chart import XL_CHART_TYPE

    from pptx.util import Cm #Inches

    from pptx.enum.chart import XL_LEGEND_POSITION

    if __name__ == '__main__':

    # 创建幻灯片 ------

    prs = Presentation('template.pptx')

    title_only_slide_layout = prs.slide_layouts[5]

    slide = prs.slides.add_slide(title_only_slide_layout)

    shapes = slide.shapes

    shapes.title.text = '报告'

    # 定义表格数据 ------

    name_objects = ["object1", "object2", "object3"]

    name_AIs = ["AI1", "AI2", "AI3"]

    val_AI1 = (19.2, 21.4, 16.7)

    val_AI2 = (22.3, 28.6, 15.2)

    val_AI3 = (20.4, 26.3, 14.2)

    val_AIs = [val_AI1, val_AI2, val_AI3]

    # 表格样式 --------------------

    rows = 4

    cols = 4

    top = Cm(12.5)

    left = Cm(3.5) #Inches(2.0)

    width = Cm(24) # Inches(6.0)

    height = Cm(6) # Inches(0.8)

    # 添加表格到幻灯片 --------------------

    table = shapes.add_table(rows, cols, left, top, width, height).table

    # 设置单元格宽度

    table.columns[0].width = Cm(6)# Inches(2.0)

    table.columns[1].width = Cm(6)

    table.columns[2].width = Cm(6)

    table.columns[3].width = Cm(6)

    # 设置标题行

    table.cell(0, 1).text = name_objects[0]

    table.cell(0, 2).text = name_objects[1]

    table.cell(0, 3).text = name_objects[2]

    # 填充数据

    table.cell(1, 0).text = name_AIs[0]

    table.cell(1, 1).text = str(val_AI1[0])

    table.cell(1, 2).text = str(val_AI1[1])

    table.cell(1, 3).text = str(val_AI1[2])

    table.cell(2, 0).text = name_AIs[1]

    table.cell(2, 1).text = str(val_AI2[0])

    table.cell(2, 2).text = str(val_AI2[1])

    table.cell(2, 3).text = str(val_AI2[2])

    table.cell(3, 0).text = name_AIs[2]

    table.cell(3, 1).text = str(val_AI3[0])

    table.cell(3, 2).text = str(val_AI3[1])

    table.cell(3, 3).text = str(val_AI3[2])

    # 定义图表数据 ---------------------

    chart_data = ChartData()

    chart_data.categories = name_objects

    chart_data.add_series(name_AIs[0], val_AI1)

    chart_data.add_series(name_AIs[1], val_AI2)

    chart_data.add_series(name_AIs[2], val_AI3)

    # 添加图表到幻灯片 --------------------

    x, y, cx, cy = Cm(3.5), Cm(4.2), Cm(24), Cm(8)

    graphic_frame = slide.shapes.add_chart(

    XL_CHART_TYPE.COLUMN_CLUSTERED, x, y, cx, cy, chart_data

    )

    chart = graphic_frame.chart

    chart.has_legend = True

    chart.legend.position = XL_LEGEND_POSITION.TOP

    chart.legend.include_in_layout = False

    value_axis = chart.value_axis

    value_axis.maximum_scale = 100.0

    value_axis.has_title = True

    value_axis.axis_title.has_text_frame = True

    value_axis.axis_title.text_frame.text = "False positive"

    value_axis.axis_title.text_frame.auto_size

    prs.save('test_template.pptx')

    本文用到的源码

    下载地址

    利用场景 周期性数据汇总及报表生成 业务或项目等数据可视化

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持聚米学院。

    展开全文
  • 本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt环境python 3python-pptx安装pip3 install python-pptx将文字输出到ppt效果图代码from pptx import Presentation# 创建幻灯片 ------prs = ...

    本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt

    环境

    python 3

    python-pptx

    安装

    pip3 install python-pptx

    将文字输出到ppt

    效果图

    代码

    from pptx import Presentation

    # 创建幻灯片 ------

    prs = Presentation()

    title_slide_layout = prs.slide_layouts[0]

    slide = prs.slides.add_slide(title_slide_layout)

    title = slide.shapes.title

    subtitle = slide.placeholders[1]

    # 设置标题和副标题

    title.text = "Hello, World!"

    subtitle.text = "pip install python-pptx"

    prs.save("test.pptx")

    图表输出到ppt

    效果图

    代码

    from pptx import Presentation

    from pptx.chart.data import ChartData

    from pptx.enum.chart import XL_CHART_TYPE

    from pptx.util import Inches

    # 创建幻灯片 ------

    prs = Presentation()

    slide = prs.slides.add_slide(prs.slide_layouts[5])

    # 定义图表数据 ---------------------

    chart_data = ChartData()

    chart_data.categories = ['East', 'West', 'Midwest']

    chart_data.add_series('Series 1', (19.2, 21.4, 16.7))

    # 将图表添加到幻灯片 --------------------

    x, y, cx, cy = Inches(2), Inches(2), Inches(6), Inches(4.5)

    slide.shapes.add_chart(

    XL_CHART_TYPE.COLUMN_CLUSTERED, x, y, cx, cy, chart_data

    )

    prs.save('chart-01.pptx')

    使用ppt模板来生成ppt

    准备ppt模板(网络下载或自定义幻灯片母版)

    加载ppt模板,并使用指定幻灯片样式

    添加数据并生成新ppt

    效果图

    代码

    from pptx import Presentation

    from pptx.util import Inches

    from pptx import Presentation

    from pptx.chart.data import ChartData

    from pptx.enum.chart import XL_CHART_TYPE

    from pptx.util import Cm #Inches

    from pptx.enum.chart import XL_LEGEND_POSITION

    if __name__ == '__main__':

    # 创建幻灯片 ------

    prs = Presentation('template.pptx')

    title_only_slide_layout = prs.slide_layouts[5]

    slide = prs.slides.add_slide(title_only_slide_layout)

    shapes = slide.shapes

    shapes.title.text = '报告'

    # 定义表格数据 ------

    name_objects = ["object1", "object2", "object3"]

    name_AIs = ["AI1", "AI2", "AI3"]

    val_AI1 = (19.2, 21.4, 16.7)

    val_AI2 = (22.3, 28.6, 15.2)

    val_AI3 = (20.4, 26.3, 14.2)

    val_AIs = [val_AI1, val_AI2, val_AI3]

    # 表格样式 --------------------

    rows = 4

    cols = 4

    top = Cm(12.5)

    left = Cm(3.5) #Inches(2.0)

    width = Cm(24) # Inches(6.0)

    height = Cm(6) # Inches(0.8)

    # 添加表格到幻灯片 --------------------

    table = shapes.add_table(rows, cols, left, top, width, height).table

    # 设置单元格宽度

    table.columns[0].width = Cm(6)# Inches(2.0)

    table.columns[1].width = Cm(6)

    table.columns[2].width = Cm(6)

    table.columns[3].width = Cm(6)

    # 设置标题行

    table.cell(0, 1).text = name_objects[0]

    table.cell(0, 2).text = name_objects[1]

    table.cell(0, 3).text = name_objects[2]

    # 填充数据

    table.cell(1, 0).text = name_AIs[0]

    table.cell(1, 1).text = str(val_AI1[0])

    table.cell(1, 2).text = str(val_AI1[1])

    table.cell(1, 3).text = str(val_AI1[2])

    table.cell(2, 0).text = name_AIs[1]

    table.cell(2, 1).text = str(val_AI2[0])

    table.cell(2, 2).text = str(val_AI2[1])

    table.cell(2, 3).text = str(val_AI2[2])

    table.cell(3, 0).text = name_AIs[2]

    table.cell(3, 1).text = str(val_AI3[0])

    table.cell(3, 2).text = str(val_AI3[1])

    table.cell(3, 3).text = str(val_AI3[2])

    # 定义图表数据 ---------------------

    chart_data = ChartData()

    chart_data.categories = name_objects

    chart_data.add_series(name_AIs[0], val_AI1)

    chart_data.add_series(name_AIs[1], val_AI2)

    chart_data.add_series(name_AIs[2], val_AI3)

    # 添加图表到幻灯片 --------------------

    x, y, cx, cy = Cm(3.5), Cm(4.2), Cm(24), Cm(8)

    graphic_frame = slide.shapes.add_chart(

    XL_CHART_TYPE.COLUMN_CLUSTERED, x, y, cx, cy, chart_data

    )

    chart = graphic_frame.chart

    chart.has_legend = True

    chart.legend.position = XL_LEGEND_POSITION.TOP

    chart.legend.include_in_layout = False

    value_axis = chart.value_axis

    value_axis.maximum_scale = 100.0

    value_axis.has_title = True

    value_axis.axis_title.has_text_frame = True

    value_axis.axis_title.text_frame.text = "False positive"

    value_axis.axis_title.text_frame.auto_size

    prs.save('test_template.pptx')

    本文用到的源码

    利用场景

    周期性数据汇总及报表生成

    业务或项目等数据可视化

    以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持找一找教程网。

    展开全文
  • 本例是Java通用代码生成器InfinityGPGenerator理论PPT。 文档名《Infinity面向棱柱动词算子式通用目的代码生成器详细设计》
    本例是Java通用代码生成器InfinityGPGenerator理论PPT。
    文档名《Infinity面向棱柱动词算子式通用目的代码生成器详细设计》
    展开全文
  • 系统环境 ...代码 import pptx import openpyxl import time import os import math from pptx import Presentation from openpyxl import load_workbook from pptx.util import Inches, Pt, Cm from

    系统环境

    1. 系统:window
    2. 环境:
    • python 3.7
    • pip
    • pptx
    • openpyxl
    1. 开发工具

    引入需要的包

    pip install openpyxl
    
    pip install python-pptx
    
    pip install jupyter
    

    配置config.ini文件

    [base]
    basePPTpath = E:\anna\base\base-2.pptx
    baseExcelPath = E:\anna\LEP#185会议议程.xlsx
    targetPPTpath =E:\anna\base\LEP#185会议议程.pptx
    sheetName =会议议程前页
    voting=E:\anna\base\VOTING.png
    backGrounBase=E:\anna\base\backgroud.png
    backGroundQR=E:\anna\base\QR_CODE_BACKGROUND.png

    准备文件

    在这里插入图片描述
    代码

    import pptx
    import openpyxl
    import time
    import  os
    import math
    from pptx import Presentation
    from openpyxl import load_workbook
    from pptx.util import Inches, Pt, Cm
    from pptx.dml.color import RGBColor
    from pptx.enum.text import PP_PARAGRAPH_ALIGNMENT,MSO_AUTO_SIZE
    from pptx.enum.shapes import MSO_AUTO_SHAPE_TYPE
    from pptx.enum.dml import MSO_FILL_TYPE
    from configparser import ConfigParser
    import os
    import copy
    import numpy as np
    import datetime, calendar
    import queue
    
    
    def getCurrentFriday():
        lastFriday = datetime.date.today()
        oneday = datetime.timedelta(days=1)
        while lastFriday.weekday() != calendar.FRIDAY:
            lastFriday += oneday
        return str(lastFriday.strftime("%Y.%m.%d"))
    
    def addTimeRule(prs):
        copied_slide = prs.slides[15]
        workbook = load_workbook(filename=baseExcelPath)
        sheet = workbook["会议议程后页"]
        for j, shape in enumerate(copied_slide.shapes):
            if shape.has_table:
                shape.table.cell(0,0).text = "Type of Speech"
                shape.table.cell(0,0).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0,0).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0,0).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(0, 0).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(1, 0).text = sheet.cell(row=30, column=1).value
                shape.table.cell(1, 0).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1, 0).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(1,0).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(2, 0).text = sheet.cell(row=31, column=1).value
                shape.table.cell(2, 0).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(2, 0).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(2,0).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(3, 0).text = sheet.cell(row=32, column=1).value
                shape.table.cell(3, 0).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(3, 0).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(3,0).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(4, 0).text = sheet.cell(row=33, column=1).value
                shape.table.cell(4, 0).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(4, 0).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(4,0).text_frame.paragraphs[0].font.size = Pt(20)
    
                shape.table.cell(0, 1).text = sheet.cell(row=29, column=11).value
                shape.table.cell(0, 1).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0, 1).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0, 1).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(0,1).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(1, 1).text = sheet.cell(row=30, column=11).value
                shape.table.cell(1, 1).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1,1).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(2, 1).text = sheet.cell(row=31, column=11).value
                shape.table.cell(2, 1).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(2,1).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(3, 1).text = sheet.cell(row=32, column=11).value
                shape.table.cell(3, 1).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(3,1).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(4, 1).text = sheet.cell(row=33, column=11).value
                shape.table.cell(4, 1).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(4,1).text_frame.paragraphs[0].font.size = Pt(20)
    
                shape.table.cell(0, 2).text = sheet.cell(row=29, column=17).value
                shape.table.cell(0, 2).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0, 2).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0, 2).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(0,2).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(1, 2).text = sheet.cell(row=30, column=17).value
                shape.table.cell(1, 2).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1,2).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(2, 2).text = sheet.cell(row=31, column=17).value
                shape.table.cell(2, 2).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(2,2).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(3, 2).text = sheet.cell(row=32, column=17).value
                shape.table.cell(3, 2).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(3,2).text_frame.paragraphs[0].font.size = Pt(20)
    
                shape.table.cell(0, 3).text = sheet.cell(row=29, column=23).value
                shape.table.cell(0, 3).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0, 3).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0, 3).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(0,3).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(1, 3).text = sheet.cell(row=30, column=23).value
                shape.table.cell(1, 3).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1,3).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(3, 3).text = sheet.cell(row=32, column=23).value
                shape.table.cell(3, 3).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(3,3).text_frame.paragraphs[0].font.size = Pt(20)
    
                shape.table.cell(0, 4).text = sheet.cell(row=29, column=28).value
                shape.table.cell(0, 4).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0, 4).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0, 4).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(0,4).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(1, 4).text = sheet.cell(row=30, column=28).value
                shape.table.cell(1, 4).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1,4).text_frame.paragraphs[0].font.size = Pt(20)
    
                shape.table.cell(0, 5).text = sheet.cell(row=29, column=34).value
                shape.table.cell(0, 5).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(0, 5).text_frame.paragraphs[0].font.bold = True
                shape.table.cell(0, 5).text_frame.paragraphs[0].font.color.rgb = RGBColor(0, 0, 0)
                shape.table.cell(0,5).text_frame.paragraphs[0].font.size = Pt(20)
                shape.table.cell(1, 5).text = sheet.cell(row=30, column=34).value
                shape.table.cell(1, 5).text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
                shape.table.cell(1,5).text_frame.paragraphs[0].font.size = Pt(20)
        copied_slide.shapes[2].text_frame.text="Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
        copied_slide.shapes[2].text_frame.paragraphs[0].font.size = Pt(18)
        copied_slide.shapes[2].text_frame.paragraphs[0].font.color.rgb = RGBColor(242, 242, 242)
        copied_slide.shapes[2].text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.RIGHT
    
    
    def duplicate_slide(pres,index):
        slide = pres.slides[index]
        blank_slide_layout = pres.slide_layouts[6] #空白页
        copied_slide = pres.slides.add_slide(blank_slide_layout)
        for shape in slide.shapes:
            el = shape.element
            newel = copy.deepcopy(el)
            copied_slide.shapes._spTree.insert_element_before(newel, 'p:extLst')
        for value in slide.part.rels.values():
            # Make sure we don't copy a notesSlide relation as that won't exist
            if "notesSlide" not in value.reltype:
                copied_slide.part.rels.add_relationship(value.reltype,value._target, value.rId)
        arrayList=np.array([0,1,2,3,4,5,6])
        # clear_shape(copied_slide,arrayList)
        return copied_slide
    def addTopic(copied_slide,topic,topOrBottom):
        if(topOrBottom=="top"):
            topic_shape = copied_slide.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, Cm(0.81), Cm(11.71), Cm(32.25), Cm(2.03))
        elif(topOrBottom=="bottom"):
            topic_shape = copied_slide.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, Cm(0.04), Cm(9.72), Cm(33.79), Cm(2.03))
        else:
            raise Exception('log position Error')
        topic_shape.text_frame.text=topic
        # topic_shape.text_frame.auto_size=MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
        topic_shape.fill.background()
        topic_shape.line.fill.background()
        topic_shape.text_frame.margin_bottom=Cm(0.13)
        topic_shape.text_frame.margin_top=Cm(0.13)
        topic_shape.text_frame.margin_left = Cm(0.25)
        topic_shape.text_frame.margin_right = Cm(0.25)
        para = topic_shape.text_frame.paragraphs[0]
        para.alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
        font = para.font
        font.size = Pt(72)
        font.name = 'Arial'
        font.bold = True
        font.color.rgb = RGBColor(254, 238, 159)
    
    def addLogandTime(copied_slide,topOrBottom):
    
        if(topOrBottom=="top"):
            topic_shape = copied_slide.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, Cm(4.23), Cm(0.90), Cm(25.40), Cm(2.54))
            topic_shape.text_frame.text ="Shanghai L.E.P. Bilingual Toastmasters Club #185 | " + getCurrentFriday()
            # topic_shape.text_frame.auto_size=MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
            topic_shape.fill.background()
            topic_shape.line.fill.background()
            topic_shape.text_frame.margin_bottom = Cm(0.13)
            topic_shape.text_frame.margin_top = Cm(0.13)
            topic_shape.text_frame.margin_left = Cm(0.25)
            topic_shape.text_frame.margin_right = Cm(0.25)
            para = topic_shape.text_frame.paragraphs[0]
            para.alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
            font = para.font
            font.size = Pt(24)
            font.name = 'Arial'
            font.bold = False
            font.color.rgb = RGBColor(255, 255, 255)
        elif(topOrBottom=="bottom"):
            topic_shape = copied_slide.shapes.add_shape(MSO_AUTO_SHAPE_TYPE.RECTANGLE, Cm(4.23), Cm(16.15), Cm(25.40), Cm(2.54))
            topic_shape.text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185"
            p=topic_shape.text_frame.add_paragraph()
            p.text = getCurrentFriday()
            topic_shape.fill.background()
            topic_shape.line.fill.background()
            topic_shape.text_frame.margin_bottom = Cm(0.13)
            topic_shape.text_frame.margin_top = Cm(0.13)
            topic_shape.text_frame.margin_left = Cm(0.25)
            topic_shape.text_frame.margin_right = Cm(0.25)
            para = topic_shape.text_frame.paragraphs[0]
            para.alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
            font = para.font
            font.size = Pt(24)
            font.name = 'Arial'
            font.bold = False
            font.color.rgb = RGBColor(255, 255, 255)
            para = topic_shape.text_frame.paragraphs[1]
            para.alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
            font = para.font
            font.size = Pt(24)
            font.name = 'Arial'
            font.bold = False
            font.color.rgb = RGBColor(255, 255, 255)
        else:
            raise Exception('log position Error')
    def addtopicKey(copied_slide,topicKey,referee):
        if(referee==None):
            textbox = copied_slide.shapes.add_textbox(Cm(3.75),
                                                      Cm(8.28),
                                                      Cm(30.11),
                                                      Cm(2.03)
                                                      )
            tf = textbox.text_frame
            para = tf.paragraphs[0]
            para.text = topicKey
            # 设置字体属性
            font = para.font
            font.size = Pt(20)  # 大小
            font.name = 'Arial'  # 字体
            font.bold = False  # 加粗
            font.italic = False  # 倾斜
            font.color.rgb = RGBColor(254, 238, 159)  # 黄色
        else:
            textbox = copied_slide.shapes.add_textbox(Cm(3.75),
                                                      Cm(8.28),
                                                      Cm(30.11),
                                                      Cm(2.03)
                                                      )
            tf = textbox.text_frame
            para = tf.paragraphs[0]
            para.text = topicKey
            p = tf.add_paragraph()
            p.text=referee
            # 设置字体属性
            font = para.font
            font.size = Pt(20)  # 大小
            font.name = 'Arial'  # 字体
            font.bold = False  # 加粗
            font.italic = False  # 倾斜
            font.color.rgb = RGBColor(254, 238, 159)  # 黄色
            font = p.font
            font.size = Pt(20)  # 大小
            font.name = 'Arial'  # 字体
            font.bold = False  # 加粗
            font.italic = False  # 倾斜
            font.color.rgb = RGBColor(254, 238, 159)  # 黄色
    def addQRcode(prs,back_ground_path,QR_path):
        blank_slide_layout = prs.slide_layouts[0]
        # add topic and author
        copied_slide = prs.slides.add_slide(blank_slide_layout)
        left = top = 0
        pic = copied_slide.shapes.add_picture(back_ground_path, left, top, height=prs.slide_height)
        textbox = copied_slide.shapes.add_textbox(Cm(0.77),
                                                  Cm(0.82),
                                                  Cm(32.35),
                                                  Cm(1.79)
                                                  )
        tf = textbox.text_frame
        para = tf.paragraphs[0]
        para.text = "Vote"
        # 设置字体属性
        font = para.font
        font.size = Pt(36)  # 大小
        font.name = 'Arial'  # 字体
        font.bold = True  # 加粗
        font.italic = False  # 倾斜
        font.color.rgb = RGBColor(51, 51, 51)  # 黑色
        copied_slide.shapes.add_picture(QR_path, Cm(9.38), Cm(3.96), Cm(13.45), Cm(13.45))
    
    ##添加一个slide的方法
    ##topicKey 'CC9', 'Ice breaker', 'Free speech'
    ##topic 演讲主题
    ##author 作者
    ##是否加书名号
    def addSlide(BackGrounBase,prs,topicKey,topic,author,book_title_flag,topOrBottom,referee):
        blank_slide_layout = prs.slide_layouts[0]
        # add topic and author
        copied_slide = prs.slides.add_slide(blank_slide_layout)
        left = top = 0
        pic = copied_slide.shapes.add_picture(BackGrounBase,left, top, height = prs.slide_height)
        if(book_title_flag==True):
            addTopic(copied_slide,"《"+topic+"》",topOrBottom)
        else:
            addTopic(copied_slide,topic,topOrBottom)
        #addLogandTime
        addLogandTime(copied_slide,topOrBottom)
        if(author!=None):
            # sub title
            addtopicKey(copied_slide,topicKey,referee)
            # add author
            textbox = copied_slide.shapes.add_textbox(1524000,
                                                      5452870,
                                                      9144000,
                                                      914400
                                                      )
            tf = textbox.text_frame
            para = tf.paragraphs[0]
            para.text = author
            para.alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
            # 设置字体属性
            font = para.font
            font.size = Pt(28)  # 大小
            font.name = 'Arial'  # 字体
            font.bold = False  # 加粗
            font.italic = False  # 倾斜
            font.color.rgb = RGBColor(255, 255, 255)
    
    
    def PREPARED(prs,sheet,BackGrounBase):
        preNum=(sheet.max_row-14-29-2)
        topicKey = ['CC9', 'Ice breaker', 'Free speech']
        subjectQ = queue.Queue(20)
        authorQ = queue.Queue(20)
        indivIndex=0
        actua_num=0
        GENERAL_EVALUATION=False
        GENERAL_index=0
        for i in range(30, sheet.max_row-9):
            check_pre=sheet.cell(row=29, column=5).value
            if(check_pre=="PREPARED SPEECH SESSION"):
                topic=sheet.cell(row=i, column=5).value
                author = sheet.cell(row=i, column=6).value
                if(topic!="INDIVIDUAL EVALUATION SESSION" and i<=(29+preNum/2) and indivIndex==0):
                    suffix = (i - 30) % 3
                    addSlide(BackGrounBase,prs,topicKey[suffix],topic,author,True,"top",None)
                    actua_num=actua_num+1;
                    subjectQ.put(topic)
                    authorQ.put(author)
                elif(topic=="INDIVIDUAL EVALUATION SESSION" and indivIndex==0):
                    indivIndex=i
                    subjectInform= "INDIVIDUAL EVALUATION"
                    addSlide(BackGrounBase,prs, " ", subjectInform, None, False,"bottom",None)
                elif(topic!="INDIVIDUAL EVALUATION SESSION" and indivIndex!=0 and i<=(indivIndex+actua_num)):
                    subjectInform=subjectQ.get()
                    referee=authorQ.get()
                    addSlide(BackGrounBase,prs, "INDIVIDUAL EVALUATION Report for", "《"+subjectInform+"》", author, False, "top",referee)
                elif(topic!="INDIVIDUAL EVALUATION SESSION" and indivIndex!=0 and GENERAL_EVALUATION==False):
                    GENERAL_EVALUATION=True
                    subjectInform = "GENERAL EVALUATION"
                    addSlide(BackGrounBase,prs, " ", subjectInform, None, False, "bottom",None)
                elif(topic!="INDIVIDUAL EVALUATION SESSION" and indivIndex!=0 and GENERAL_EVALUATION==True and GENERAL_index<4):
                    if("General Evaluator Report"!=topic):
                        addSlide(BackGrounBase,prs, "GENERAL EVALUATION", topic, author, False, "top",None)
                    else:
                        addSlide(BackGrounBase,prs," ","GENERAL EVALUATION",author,False,"top",None)
                else:
                    continue
            else:
                raise Exception('EXCEL sheet 【会议议程前页】格式错误,请重新检查')
    
    def updateppt(BackGrounBase,BackGroundQR,basePPTPath,baseExcelPath,sheetName,votingPicture,targetPath):
        prs = Presentation(basePPTPath)
        workbook = load_workbook(filename=baseExcelPath)
        sheet = workbook[sheetName]
        topicFlag = 0
        temptopic = " "
        slide = prs.slides[0]
        master_sharing = sheet.cell(row=22, column=5).value
        slide.shapes[1].text_frame.text = master_sharing
        createTime = slide.shapes[0].text_frame.paragraphs[1]
        createTime.text = getCurrentFriday()
    
        slide8 = prs.slides[8]
        createTime = slide8.shapes[0].text_frame.paragraphs[1]
        createTime.text = getCurrentFriday()
    
        slide9 = prs.slides[9]
        slide9.shapes[2].text_frame.text=sheet.cell(row=17, column=6).value
        slide9.shapes[3].text_frame.text="Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide10 = prs.slides[10]
        slide10.shapes[2].text_frame.text=sheet.cell(row=18, column=6).value
        slide10.shapes[3].text_frame.text="Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide11 = prs.slides[11]
        slide11.shapes[0].text_frame.text=sheet.cell(row=18, column=8).value
        slide11.shapes[1].text_frame.text=sheet.cell(row=18, column=9).value
        slide11.shapes[2].text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185 | " + getCurrentFriday()
        slide11.shapes[2].text_frame.paragraphs[0].font.color.rgb = RGBColor(242, 242, 242)
        slide11.shapes[2].text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.RIGHT
        slide11.shapes[2].text_frame.paragraphs[0].font.size = Pt(18)
    
        slide12 = prs.slides[12]
        slide12.shapes[2].text_frame.text=sheet.cell(row=19, column=6).value
        slide12.shapes[3].text_frame.text="Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide13 = prs.slides[13]
        slide13.shapes[0].text_frame.text=sheet.cell(row=19, column=8).value
        slide13.shapes[1].text_frame.text=sheet.cell(row=19, column=9).value
        slide13.shapes[2].text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185 | " + getCurrentFriday()
        slide13.shapes[2].text_frame.paragraphs[0].font.color.rgb = RGBColor(242, 242, 242)
        slide13.shapes[2].text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.RIGHT
        slide13.shapes[2].text_frame.paragraphs[0].font.size = Pt(18)
    
        slide14 = prs.slides[14]
        slide14.shapes[2].text_frame.text=sheet.cell(row=20, column=6).value
        slide14.shapes[3].text_frame.text="Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        #需要加时间规则
        addTimeRule(prs)
    
        slide16 = prs.slides[16]
        slide16.shapes[1].text_frame.text=sheet.cell(row=22, column=6).value
        slide16.shapes[1].text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
        slide16.shapes[2].text_frame.paragraphs[1].text=getCurrentFriday()
    
        slide17 = prs.slides[17]
        slide17.shapes[0].text_frame.text=sheet.cell(row=24, column=5).value
        slide17.shapes[2].text_frame.text=sheet.cell(row=24, column=6).value
        slide17.shapes[3].text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide18 = prs.slides[18]
        slide18.shapes[2].text_frame.text=sheet.cell(row=25, column=6).value
        slide18.shapes[3].text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide19 = prs.slides[19]
        slide19.shapes[1].text_frame.text=sheet.cell(row=27, column=6).value
        slide19.shapes[1].text_frame.paragraphs[0].alignment = PP_PARAGRAPH_ALIGNMENT.CENTER
        slide19.shapes[2].text_frame.text = "Shanghai L.E.P. Bilingual Toastmasters Club #185 | "+getCurrentFriday()
    
        slide8 = prs.slides[20]
        createTime = slide8.shapes[0].text_frame.paragraphs[1]
        createTime.text = getCurrentFriday()
        #备稿部分
        PREPARED(prs,sheet,BackGrounBase)
        #二维码
        addQRcode(prs,BackGroundQR,votingPicture)
        #致谢
        addSlide(BackGrounBase, prs, " ", "JOIN US", None, False, "bottom", None)
        addSlide(BackGrounBase, prs, " ", "AWARDING", None, False, "bottom", None)
    
        prs.save(targetPath)
    
    if __name__ == '__main__':
        conn = ConfigParser()
        file_path=os.path.join(os.path.abspath('.'),'config.ini')
        if not os.path.exists(file_path):
            raise FileNotFoundError("文件不存在")
    
        conn.read(file_path)
        basePPTpath = conn.get('base', 'basePPTpath')
        baseExcelPath = conn.get('base', 'baseExcelPath')
        targetPPTpath = conn.get('base', 'targetPPTpath')
        sheetName = conn.get('base', 'sheetName')
        voting=conn.get('base', 'voting')
        BackGrounBase = conn.get('base', 'backGrounBase')
        BackGroundQR= conn.get('base', 'backGroundQR')
        updateppt(BackGrounBase,BackGroundQR,basePPTpath,baseExcelPath,sheetName,voting,targetPPTpath)
    
    

    Window代码打包

    pyinstaller -F operaPPT.py
    

    Mac电脑打包python代码.

    参考文档: pptx官网.

    展开全文
  • MDA:模型驱动体系(Model Driven Architecture) 代码生成机制 OOM?OOM从分析(Analysis)语言到具体语言(如Java等)的转换 OOM?PDM自顶向下先行根据需求设计出领域模型然后PowerDesigner会自动转换为数据库模型并同时...
  • 使用python生成ppt

    万次阅读 多人点赞 2018-01-03 21:28:51
    本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt 环境 python 3 python-pptx 安装 pip3 install python-pptx 将文字输出到ppt 效果图 代码 from pptx import Presentation # 创建...
  • python生成ppt的方法

    2021-01-20 04:40:13
    本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt 环境 python 3 python-pptx 安装 pip3 install python-pptx 将文字输出到ppt 效果图 代码 from pptx import Presentation # 创建幻灯片 ---...
  • 工具包:https://github.com/gasongjian/reportgen项目地址:https://github.com/gasongjian/,欢迎 star或者 ...包括但不仅限于 问卷星原始数据、 问卷网原始数据主要功能1: 自动生成概述性质的报告(ppt格式,针对...
  • 本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt环境python 3python-pptx安装pip3 install python-pptx将文字输出到ppt效果图代码from pptx import Presentation# 创建幻灯片 ------prs = ...
  • * p281 * 1代码区该区域存放目标代码大部分程序的目标代码空间大小可以在编译过程中得知部分面向RISC架构的编译器也会把无法编入指令代码的较大常数放入代码区作为目标代码的一部分程序在运行过程中可以通过指令...
  • 2020Ch10目标代码生成.ppt
  • 学习重点 9.1 语义分析的概念 9.1 语义分析的概念 9.2 中间代码 9.2 中间代码 9.2 中间代码 9.2 中间代码 9.2 中间代码 9.3 声明的处理 9.4 表达式语句 9.5 if 语句 9.5 if 语句 9.6 while语句 9.7 for循环语句 9.7 ...
  • 9.2 中间代码 ;9.2 中间代码;9.2 中间代码;9.2 中间代码;9.2 中间代码;波兰后缀表示除可用来表示表达式类的语言结构以外也能够通过操作符的扩充来表示其他的语言结构;9.2 中间代码;9.2 中间代码;三元式的一般表示:
  • 在第十四届D2前端技术论坛阿里高级前端技术专家@甄子做了《前端智能化实践》—逻辑代码生成的分享。本PPT由@甄子授权分享。 ...
  • 本文主要介绍如何通过python生成ppt文件,以及借助ppt模板来生成ppt环境python 3python-pptx安装pip3 install python-pptx将文字输出到ppt效果图代码from pptx import Presentation# 创建幻灯片 ------prs = ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 459
精华内容 183
关键字:

代码生成ppt