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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file automate_office-0.3.1.tar.gz.

File metadata

  • Download URL: automate_office-0.3.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for automate_office-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6cfc8e6ae767aaf19eded7b754f356663a8278b371cb8612c14dbe7ef96c157d
MD5 6da302ae938b8e65dddc1974c582d604
BLAKE2b-256 4f42760c7b6200e73bc9ef2131aa5c5f25b903dcae440151b20b9e93c28c41bd

See more details on using hashes here.

File details

Details for the file automate_office-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for automate_office-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f73fd8e1fce9a331b965c6b8805bf0776678c2d9b5daeec3265cb8c34e31d3ac
MD5 d13e398bcec84ef46f1643f5c77d60b4
BLAKE2b-256 80c623394be4a9811309e01dd9eb2e6ba7deffa854406bcb9a5ed2b9095285b9

See more details on using hashes here.

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