Skip to main content

Offic自动化工具-自用,在原有包的基础上二次开发, PPT部分暂时告一段落, Word暂时用处不大, Excel做了一些函数和例子

Project description

PPT

空slide

  1. 创建空PPT, 支持inches和cm

    from automate_office.automate_ppt.MyPPTCreator import PPTCreator
    my_ppt = PPTCreator(size_params={"unit_type": "inches", "width": 10, "height": 5.625})
    
  2. 存储PPT,默认存储在Downloads目录下

    my_ppt.save_pptx(filename=None, save_path=None)
    
  3. 创建slide

    my_slide = my_ppt.create_slide(slide_idx=6)
    
  4. 创建文本框

    my_ppt.add_textbox(
        self, 
        cur_slide: slide.Slide, 
        # left top width height, 相对于长宽的比例,0-1之间
        rel_coordinate=(0, 0, 1, 1), 
        paragraph_infos=None
    )
    
    • paragraph_infos: 下面是一个例子
    paragraph_infos = [
        {
            "对齐": "居中",
            "文字": [
                ["段落1第1部分文字", "微软雅黑", 12, False, False, (0, 255, 0)],
                ["段落1第2部分文字", "微软雅黑", 12, False, False, (0, 0, 255)],
                ...
            ],
            "段落间距": 8
        },
        {
            "对齐": "左对齐",
            "文字": [
                ["段落2第1部分文字", "微软雅黑", 12, False, False, (0, 255, 0)],
                ["段落2第2部分文字", "微软雅黑", 12, False, False, (0, 0, 255)],
                ...
            ],
            "段落间距": 8
        },
    ]
    
  5. 创建矩形

    my_ppt.add_rectangle_shape
    
  6. 创建图片

    my_ppt.add_picture
    
  7. 创建柱状图

    my_ppt.add_bar_chart
    
  8. 创建折线图

    my_ppt.add_line_chart
    
  9. 创建饼图

    my_ppt.add_pie_chart
    
  10. 创建表格

    my_ppt.add_table
    
  11. 修改已有PPT的文字

    from automate_office.automate_ppt.modify_ppt import set_textframe
    set_textframe(text_frame, paragraph_infos=None, vertical_anchor = MSO_ANCHOR.MIDDLE)
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automate_office-0.3.1.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

automate_office-0.3.1-py3-none-any.whl (19.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page