Kích thước phông chữ hộp văn bản pptx Python

Mới trong v1. 23. tạo tệp PPTX bằng cách sử dụng cấu hình và PPTX hiện có làm mẫu. Kết quả là một PPTX mới mà người dùng có thể tải xuống

Dưới đây là một ví dụ về thay thế văn bản đơn giản

url:
  pptxhandler/ppt:
    pattern: /$YAMLURL/ppt
    handler: PPTXHandler
    kwargs:
      only: 1
      source: $YAMLPATH/input.pptx    # Input file to load
      change-text:                    # First rule is called change-text
        Title 1:                      #   Find all shapes named "Title 1" in all slide number 1
          text: Generated by Gramex   #   Replace their text
      headers:
        Content-Disposition: attachment; filename=output.pptx

Ghi chú. tất cả các ví dụ sử dụng các trang trình bày cụ thể từ ví dụ đầu vào. pptx

Các quy tắc được dựa trên những gì được mô tả dưới đây

PPTGen cho phép bạn sửa đổi nội dung của bản trình bày PowerPoint dựa trên dữ liệu. Ví dụ, bạn có thể

  • Cập nhật biểu đồ, hình ảnh và văn bản từ dữ liệu
  • Tạo một loạt trang chiếu bằng mẫu từ bảng tính hoặc cơ sở dữ liệu

Nó là một tiện ích dòng lệnh và một chức năng Python được đóng gói với Gramex. Nó tạo thành cơ sở của PPTXHandler

Thư viện PPTGen

Thư viện PPTGen chấp nhận một cấu hình làm đối số của nó. Ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]

Đây là một ví dụ khác thay đổi biểu đồ thanh dựa trên dữ liệu

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]

Cấu hình chấp nhận các khóa cấp cao nhất sau đây

  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    8 bắt buộc. Đường dẫn đến đầu vào / nguồn PPTX
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    9 tùy chọn. Đường dẫn lưu PPTX đầu ra/đích. Nếu Không,
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    0 trả về đối tượng Bản trình bày
  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 tập dữ liệu tùy chọn hoặc từ điển. Điều này được mô tả dưới đây
  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    2 Chấp nhận số trang chiếu hoặc danh sách số trang chiếu bắt đầu từ 1. Nếu được xác định, trong bản trình bày đầu ra sẽ chỉ có sẵn các trang chiếu được chọn. Giả sử có 10 slide trong một bài thuyết trình nhưng người dùng đã xác định
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    3 trong phần
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    4 thì chỉ slide số 1 sẽ có sẵn trong đầu ra, tương tự slide số 1 và 2 sẽ có sẵn trong bài thuyết trình đầu ra nếu
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    5
  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    6 Tùy chọn đăng ký bất kỳ lệnh tùy chỉnh mới nào cho pptgen. Nó chấp nhận một hàm chấp nhận ba tham số
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    7,
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    8 và
        source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    9. Các lệnh
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    0 có sẵn trong pptgen là
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    1,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    2,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    3,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    4,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    5,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    6,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    7,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    8,
    source: input.pptx
    target: output.pptx
    rule-1:                 # rule-1 applies to all slides
      ...
    rule-2:
      slide-number: 1       # rule-2 applies only to the first slide of the source
      ...
    rule-3:
      slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
      ...
      ...
    
    9,
        rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    0 và
        rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    1
  • Tất cả các khóa khác được coi là quy tắc được mô tả bên dưới

Dữ liệu

PPTGen có thể thay đổi bài thuyết trình với dữ liệu từ nhiều nguồn khác nhau. Nó sử dụng

    rule-1:
      Title 1:                 # Shape name "Title 1" will be updated by text "New title"
        text: New title
        style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
          color: '#ff0000'
      Text 1:                 # Shape name "Text 1" will be updated by text "New text"
        text: New text
        style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
          color: '#00ff00'
          bold: True           # Text will appear in bold
2. Nó hỗ trợ các phím này

  •     rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    3 Pandas DataFrame, URL sqlalchemy hoặc tên tệp
  • Phần mở rộng tệp
        rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    4 [nếu url là một tệp]. Mặc định cho tiện ích mở rộng url
  •     rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    5 bộ lọc tùy chọn để áp dụng cho tập dữ liệu. Được thông qua như một danh sách chính tả
  • Tên bảng
        rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    6 [nếu url là URL SQLAlchemy]
  •     rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    7 truy vấn SQL tùy chọn để thực thi [nếu url là cơ sở dữ liệu]
  •     rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    8 biến đổi trong bộ nhớ tùy chọn. Lấy một DataFrame và trả về một DataFrame
  • Bất kỳ khóa bổ sung nào được chuyển đến
        rule-1:
          Title 1:                 # Shape name "Title 1" will be updated by text "New title"
            text: New title
            style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
              color: '#ff0000'
          Text 1:                 # Shape name "Text 1" will be updated by text "New text"
            text: New text
            style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
              color: '#00ff00'
              bold: True           # Text will appear in bold
    
    9 hoặc
        source: input.pptx
        target: output.pptx
        change-image:
          Group 1:                        # Take the shape named "Group 1"
            Caption:                      # Find the shape named "Caption" inside it
              text: New caption           #   Change its text to "New caption"
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/sample.png #   Replace the image with sample.png
    
    0

Thí dụ. -

Quy tắc

Cấu hình có thể xác định bất kỳ số lượng quy tắc nào. Nội quy có

  • một hoặc nhiều và danh sách áp dụng cho những hình dạng đó
  • một tùy chọn hạn chế chúng áp dụng cho slide nào. Theo mặc định, các quy tắc áp dụng cho tất cả các trang trình bày

Trong ví dụ bên dưới, có 1 quy tắc tên là

    source: input.pptx
    target: output.pptx
    change-image:
      Group 1:                        # Take the shape named "Group 1"
        Caption:                      # Find the shape named "Caption" inside it
          text: New caption           #   Change its text to "New caption"
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/sample.png #   Replace the image with sample.png
1. Nó không có bộ chọn trang chiếu, vì vậy nó áp dụng cho tất cả các trang chiếu. Nó có 1 hình dạng.
    source: input.pptx
    target: output.pptx
    change-image:
      Group 1:                        # Take the shape named "Group 1"
        Caption:                      # Find the shape named "Caption" inside it
          text: New caption           #   Change its text to "New caption"
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/sample.png #   Replace the image with sample.png
2 với 1 lệnh.
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
2

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"

Chạy ví dụ

trang trình bày

Theo mặc định, các thay đổi được áp dụng cho tất cả các trang chiếu. Để hạn chế các thay đổi đối với một slide cụ thể, hãy sử dụng

  1.     source: input.pptx
        target: output.pptx
        change-image:
          Group 1:                        # Take the shape named "Group 1"
            Caption:                      # Find the shape named "Caption" inside it
              text: New caption           #   Change its text to "New caption"
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/sample.png #   Replace the image with sample.png
    
    4 số trang hoặc danh sách [với trang đầu tiên là trang 1]
  2.     source: input.pptx
        target: output.pptx
        change-image:
          Group 1:                        # Take the shape named "Group 1"
            Caption:                      # Find the shape named "Caption" inside it
              text: New caption           #   Change its text to "New caption"
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/sample.png #   Replace the image with sample.png
    
    5 là một biểu thức chính quy phù hợp với tiêu đề trang chiếu

source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...

Để tạo nhiều trang trình bày từ dữ liệu, hãy thêm

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1 vào phần thay đổi. Ví dụ

Chạy ví dụ

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1 này là một biến sử dụng gốc
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1. Nó có thể được sử dụng với

  •     source: input.pptx
        target: output.pptx
        change-image:
          Group 1:                        # Take the shape named "Group 1"
            Caption:                      # Find the shape named "Caption" inside it
              text: New caption           #   Change its text to "New caption"
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/sample.png #   Replace the image with sample.png
    
    4 để lặp lại 1 hoặc nhiều trang trình bày. Ví dụ:
            Caption:                      # Find the shape named "Caption" inside it
              text: "{{ args['text'] }}"  #   Change its text to ?text=
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/{{ args.get['image', 'sample'] }}.png # Replace image with ?image= or sample.png
    
    0 sẽ sao chép trang trình bày 1 & 2 nhiều lần khi có hàng dữ liệu
  •     source: input.pptx
        target: output.pptx
        change-image:
          Group 1:                        # Take the shape named "Group 1"
            Caption:                      # Find the shape named "Caption" inside it
              text: New caption           #   Change its text to "New caption"
            Picture:                      # Find the shape named "Picture" inside it
              image: $YAMLPATH/sample.png #   Replace the image with sample.png
    
    5 để lặp lại các trang chiếu riêng lẻ hoặc nhiều trang chiếu đơn lẻ

Số trang chiếu luôn đề cập đến số trang chiếu nguồn, không phải số trang chiếu đích. Ngay cả khi một trang chiếu được sao chép trong mục tiêu, số trang chiếu nguồn không thay đổi

Hình dạng

Trong PowerPoint, tất cả các hình đều có tên. Để xem tên hình dạng, hãy chọn tab Trang đầu > Nhóm vẽ > Sắp xếp trình đơn thả xuống > Ngăn lựa chọn. Hoặc nhấn ALT + F10

Để thay đổi tên hình dạng, nhấp đúp vào tên trong ngăn chọn

Bạn có thể chỉ định các thay đổi đối với một hoặc nhiều hình dạng trong một. Ví dụ

    rule-1:
      Title 1:                 # Shape name "Title 1" will be updated by text "New title"
        text: New title
        style:                 # Text color will be `red`[accepts only hex color code in 6 digit]
          color: '#ff0000'
      Text 1:                 # Shape name "Text 1" will be updated by text "New text"
        text: New text
        style:                 # Text color will be `green`[accepts only hex color code in 6 digit]
          color: '#00ff00'
          bold: True           # Text will appear in bold

… thay đổi 2 hình tên là

    source: input.pptx
    target: output.pptx
    change-image:
      Group 1:                        # Take the shape named "Group 1"
        Caption:                      # Find the shape named "Caption" inside it
          text: New caption           #   Change its text to "New caption"
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/sample.png #   Replace the image with sample.png
2 và
        Caption:                      # Find the shape named "Caption" inside it
          text: "{{ args['text'] }}"  #   Change its text to ?text=
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/{{ args.get['image', 'sample'] }}.png # Replace image with ?image= or sample.png
3

Chạy ví dụ

Tên hình dạng có thể đề cập đến các yếu tố bản địa hoặc

Các nhóm

Tên hình dạng có thể đề cập đến các nhóm. Để thay đổi nội dung của nhóm, hãy sử dụng cấu hình lồng nhau. Ví dụ: nếu “Nhóm 1” có “Chú thích” và “Hình ảnh” bên trong, thì

        Caption:                      # Find the shape named "Caption" inside it
          text: "{{ args['text'] }}"  #   Change its text to ?text=
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/{{ args.get['image', 'sample'] }}.png # Replace image with ?image= or sample.png
4 này sẽ thay thế những

    source: input.pptx
    target: output.pptx
    change-image:
      Group 1:                        # Take the shape named "Group 1"
        Caption:                      # Find the shape named "Caption" inside it
          text: New caption           #   Change its text to "New caption"
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/sample.png #   Replace the image with sample.png

Chạy ví dụ

Đối số URL PPTX

Đối số URL có thể được sử dụng làm biến trong mẫu

Trong ví dụ dưới đây, group-args-example?text=My-Text, sẽ thay thế văn bản bằng

        Caption:                      # Find the shape named "Caption" inside it
          text: "{{ args['text'] }}"  #   Change its text to ?text=
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/{{ args.get['image', 'sample'] }}.png # Replace image with ?image= or sample.png
5

        Caption:                      # Find the shape named "Caption" inside it
          text: "{{ args['text'] }}"  #   Change its text to ?text=
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/{{ args.get['image', 'sample'] }}.png # Replace image with ?image= or sample.png

Chạy ví dụ

lệnh

Có thể thay đổi hình dạng bằng 1 hoặc nhiều lệnh. Các lệnh này có thể thay đổi kiểu và nội dung của hình dạng hoặc thêm nội dung mới [như biểu đồ]

Đăng ký. Đăng ký lệnh mới cho PPTGen

Đăng ký cho phép bạn tạo một lệnh tùy chỉnh. Nó chấp nhận một chức năng sẽ chấp nhận ba tham số,

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
7,
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
8[cấu hình cho một hình dạng, cấu hình dưới tên hình dạng],
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
9 theo cùng một thứ tự. Nó sẽ không chấp nhận bất kỳ tham số nào khác ngoại trừ 3 tham số này. Bất kỳ lệnh hiện có không thể được ghi đè. Trả về một danh sách lệnh bất biến

CSS

Các lệnh giống như CSS sau đây thay đổi thuộc tính hiển thị của hình dạng

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    9. Tải dữ liệu
  •     Rectangle 1:            # Take the shape named "Rectangle 1"
          css:
            data: data['sales']
            style:
              opacity: 0.5
              color: '#ff0000'
              fill: '#ffff00'
              stroke: '#ffff00'
              width:  200
              height: 200
              left: 50
              top: 100
    
    0. Chấp nhận css như thuộc tính
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      1. đặt mức độ mờ của hình dưới dạng số thập phân từ 0 - 1
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      2. đặt màu văn bản/màu nền trước làm màu CSS
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      3. đặt màu nền của hình dạng thành màu CSS
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      4. đặt màu đường viền hình dạng làm màu CSS
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      5. đặt chiều rộng hình dạng theo điểm
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      6. đặt chiều cao hình dạng theo điểm
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      7. đặt vị trí hình dạng X theo điểm
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      8. đặt vị trí hình dạng Y theo điểm
    •     Rectangle 1:            # Take the shape named "Rectangle 1"
            css:
              data: data['sales']
              style:
                opacity: 0.5
                color: '#ff0000'
                fill: '#ffff00'
                stroke: '#ffff00'
                width:  200
                height: 200
                left: 50
                top: 100
      
      9. đặt kích thước phông chữ theo điểm
    •       Title 1:                # Take the shape named "Title 1"
              style:                # CSS like properties only for text
                color: '#ff00000'   # Text color will be red
                font-size: 12       # Setting font-size
                .......
              text: New Title       # Replace its text with "New Title"
      
      0. đặt họ phông chữ làm tên phông chữ

Thí dụ

    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100

Chạy ví dụ

Màu CSS có thể được chỉ định giống như cách chúng có thể làm trong CSS. 1 điểm là 1/72 inch. Tất cả các phần tử

    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
0 và
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
9 sẽ chấp nhận biểu thức python hoặc hàm python

hỗ trợ giá trị

Chữ

Để thay đổi tiêu đề trên trang chiếu đầu vào thành “Tiêu đề mới”, hãy sử dụng cấu hình này

      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"

Chạy ví dụ

Hỗ trợ giá trị

      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
3. Cũng hỗ trợ các thuộc tính giống như css của
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
0 cho văn bản trong phần
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
5. Tất cả các phong cách
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
6 cũng chấp nhận
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
7.
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
3 hỗ trợ
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
9 đối tượng trong văn bản đầu vào [mà giả sử được thay thế bằng] để có thuộc tính
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
1 cho một từ trong câu hoặc cụm từ.
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
01

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
0

Chạy ví dụ

Trong hình dạng ví dụ trên có tên

    source: input.pptx
    target: output.pptx
    change-image:
      Group 1:                        # Take the shape named "Group 1"
        Caption:                      # Find the shape named "Caption" inside it
          text: New caption           #   Change its text to "New caption"
        Picture:                      # Find the shape named "Picture" inside it
          image: $YAMLPATH/sample.png #   Replace the image with sample.png
2 sẽ được thay thế bằng
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
03 với màu
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
04 và
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
05 sẽ là
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
06 với màu
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
07. Nó chỉ chấp nhận thẻ
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
2 trong đầu vào xml. Mẫu xml đầu vào có thể có nhiều thẻ
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
2

Thay thế

Để thay thế văn bản thay vì , hãy sử dụng

Chạy ví dụ

Thay thế chỉ hoạt động đối với các từ có cùng định dạng. Ví dụ, ở đâu đó, “where” được gạch dưới. Bạn không thể thay thế “ở đâu đó”. Nhưng bạn có thể thay thế “some” và “where” một cách độc lập. Nó cũng hỗ trợ các thuộc tính giống như

source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
1 trong
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
5. Tất cả các yếu tố phong cách cũng chấp nhận
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
7

Hỗ trợ giá trị

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
13

Hình ảnh

Để thay đổi hình ảnh trên một hình ảnh, hãy sử dụng

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
1

Hỗ trợ giá trị

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
14 và có thể là URL hoặc đường dẫn tệp

Chạy ví dụ

Bàn

Sửa đổi các bảng hiện có. Nó chấp nhận các phím này

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 dữ liệu tùy chọn để hiển thị dưới dạng bảng. Bảng mở rộng khi thu nhỏ để chứa các hàng và cột trong dữ liệu
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    16 css chung tùy chọn cho tất cả các cột. e. g. - màu sắc, tô màu, cỡ chữ, v.v. Các thuộc tính này có thể được ghi đè bên trong một cột. Nếu không thì thuộc tính sẽ là chung cho tất cả các cột
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      17 Đúng hay Sai, nếu Đúng văn bản sẽ được in đậm
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      18 Màu của các ô
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      19 Màu văn bản
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      20 Để đặt kiểu chữ nghiêng cho văn bản
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      21 Để đặt kiểu gạch chân cho văn bản
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      22 Cỡ chữ của văn bản
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      23 Họ phông chữ của văn bản
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      24 tên dải màu tùy chọn [nhị phân, Blues, BuGn, BuPu, gist_yarg, GnBu, Greens, Greys, Oranges, OrRd, PuBu, PuBuGn, PuRd, Purples, RdPu, Reds, YlGn, YlGnBu, YlOrBr, YlOrRd, BrBG, bwr, coolwarm
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      25 tùy chọn tối thiểu. Mặc định cho giá trị tối thiểu của cột
    • from gramex.pptgen import pptgen
      pptgen[
        source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
        target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
        change={                  # Configurations are same as when loading from the YAML file
          'Title 1': {            # Take the shape named "Title 1"
            'text' 'New Title'    # Replace its text with "New Title"
          }
        }
      ]
      
      26 tùy chọn tối đa. Mặc định là giá trị tối đa của cột
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    27 Cấu hình từ điển cho các cột. Bên trong các thuộc tính kiểu này có thể được xác định và có thể ghi đè lên các kiểu phổ biến từ phần
        Rectangle 1:            # Take the shape named "Rectangle 1"
          css:
            data: data['sales']
            style:
              opacity: 0.5
              color: '#ff0000'
              fill: '#ffff00'
              stroke: '#ffff00'
              width:  200
              height: 200
              left: 50
              top: 100
    
    0. Chỉ các cột được xác định bên trong phần
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    29 mới được điền vào bên trong bảng

Thí dụ

Thí dụ

Chạy ví dụ

Để tạo nhiều hình dạng bằng cách sử dụng dữ liệu, hãy sử dụng

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
30 và
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1. Ví dụ

Chạy ví dụ

Cây rơm

Sao chép hình dạng nhiều lần dựa trên dữ liệu theo chiều dọc hoặc chiều ngang. Ví dụ

Chạy ví dụ

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1 này là một biến sử dụng gốc
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1. Đối với mỗi hàng trong
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
9, hình được nhân đôi và bố trí dựa trên
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
30

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
36 hỗ trợ các bố cục này

  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    37 sao chép phần tử bên phải với một tùy chọn
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    38 [mặc định. 0]
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    39 sao chép phần tử bên dưới với một tùy chọn
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    38 [mặc định. 0]

mẫu

Đối với các lệnh hỗ trợ mẫu, các giá trị bên trong

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
41 được đánh giá là biểu thức Python trong ngữ cảnh của
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
9

Ví dụ

Chạy ví dụ

… sẽ thay thế nội dung bên trong

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
41 bằng giá trị của
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
44 được đánh giá bằng Python. Biến
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
45 là kết quả của việc tải
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
46

Biểu thức

Đối với các lệnh hỗ trợ biểu thức, các giá trị được đánh giá là biểu thức Python trong ngữ cảnh dữ liệu. Ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
2

Lệnh không dùng nữa

  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    47 sử dụng lệnh thay thế
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    48 sử dụng lệnh thay thế

Đồ thị

Chỉnh sửa dữ liệu bên trong biểu đồ pptx gốc.

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
49 biểu đồ pptx không được hỗ trợ.
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
4 chấp nhận các thuộc tính sau. -

Ghi chú. - Tất cả các thuộc tính cũng chấp nhận biểu thức python hoặc chức năng tùy chỉnh. Như là. -

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
3

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1 Truyền dữ liệu vào biểu đồ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
52
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
53 loại. Nếu được xác định, chỉ các cột được đề cập trong danh sách sẽ chuyển qua dưới dạng dữ liệu cho biểu đồ. Chấp nhận
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
54 hoặc danh sách tên cột

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
55 Xác định tên cột
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
56 từ dữ liệu

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
57 Điều này chỉ áp dụng cho
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
58. Tên cột từ dữ liệu cho kích thước bong bóng

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
19 Chấp nhận một từ điển [hoặc giá trị thô trong trường hợp này, mã màu giống nhau sẽ được áp dụng cho tất cả các chuỗi] cho chuỗi đang được thêm vào bảng xếp hạng. Đồng thời cung cấp quyền truy cập dữ liệu cấp hàng cho chuỗi bằng cách sử dụng hàm
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
60. e. g. -

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
4

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
61 Cấu hình tương tự như
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
2

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
63 Cấu hình tương tự như
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
2

Biểu đồ gốc

Để sửa đổi dữ liệu và thuộc tính cho biểu đồ gốc hiện có, hãy sử dụng

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
65. Điều này hỗ trợ các loại biểu đồ sau

  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    66 Thanh xếp chồng, Thanh xếp chồng, Thanh xếp chồng 100%
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    67 Cột cụm, Cột xếp chồng, Cột xếp chồng 100%
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    68 Dòng, Dòng xếp chồng, Dòng xếp chồng 100%, Dòng có đánh dấu, Dòng xếp chồng có đánh dấu, Dòng xếp chồng 100% có đánh dấu
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    69 Khu vực, Khu vực xếp chồng, Khu vực xếp chồng 100% [Không hỗ trợ khu vực 3D]
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    70 Phân tán, Phân tán với Đường thẳng, Phân tán với Đường trơn, Phân tán với Đường thẳng và Điểm đánh dấu, Phân tán với Đường trơn và Điểm đánh dấu
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    71 Bong bóng, Bong bóng 3-D
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    72 Radar, Radar có điểm đánh dấu, Radar đầy
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    73 Bánh rán, Bánh rán nổ
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    74 Pie, Pie Exploded, Bar of Pie [không hỗ trợ bánh 3D]

Dưới đây là các ví dụ giả định cấu hình sau

Dưới đây là ví dụ cho các biểu đồ khác nhau

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
5

Chạy ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
6

Chạy ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
7

Chạy ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
8

Chạy ví dụ

from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
9

Chạy ví dụ

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
0

Chạy ví dụ

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
1

Chạy ví dụ

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
2

Chạy ví dụ

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
3

Chạy ví dụ

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
4

Chạy ví dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
55,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
19,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
63,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
57

Ví dụ: ví dụ này đặt độ mờ của các cột có tên "dummy" là 0. 2 và các cột khác là 1. 0

import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
5

biểu đồ tùy chỉnh

pptgen cho phép bạn tạo các biểu đồ tùy chỉnh này

  • biểu đồ dấu đầu dòng
  • sơ đồ lịch
  • lưới tản nhiệt
  • Sankey
  • sơ đồ cây

Để tạo những thứ này, hãy thêm một hình chữ nhật [không cho phép hình dạng nào khác] trong trang chiếu của bạn. Khi một biểu đồ tùy chỉnh được áp dụng trên hình chữ nhật đó, nó sẽ thay thế hình chữ nhật đó bằng biểu đồ

Đạn

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 Giá trị thực tế
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    81 Giá trị kém
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    82 Giá trị tốt
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    9 Giá trị mục tiêu
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    84 Đặt chiều rộng tối đa của hình chữ nhật. Chấp nhận
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    85 hoặc giá trị thô [từ 0-1]
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    24 Tùy chọn. Mặc định
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    87
  •       Title 1:                # Take the shape named "Title 1"
            style:                # CSS like properties only for text
              color: '#ff00000'   # Text color will be red
              font-size: 12       # Setting font-size
              .......
            text: New Title       # Replace its text with "New Title"
    
    3 Mặc định
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    89. Tùy chọn, nếu văn bản hiện tại sẽ được hiển thị theo định dạng. Văn bản có thể được ghi đè bên trong phần
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    90 hoặc
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    91 nếu được xác định ở đó
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    16 Tùy chọn
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    93, chấp nhận thuộc tính css
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    94

Thí dụ

Chạy ví dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
9,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
81,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
82,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
99,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
00,
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
2 cùng với tất cả các thuộc tính phong cách, chẳng hạn như trong phần phong cách
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
9,
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
1,
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
3,
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
2, v.v.

sơ đồ lịch

  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    06 Chiều rộng và chiều cao của mỗi ô [tính bằng pixel] trong sơ đồ lịch
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    07 Giá trị đầu tuần
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    08
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    24 Tùy chọn, mặc định
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    87
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    11 Định dạng số sẽ được hiển thị ở thanh trên cùng/trái nếu
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    12 được xác định
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    13 Giá trị tối thiểu cho thang màu
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    14
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    15 Giá trị cao cho thang màu
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    16
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    17 Lề trên cho sơ đồ lịch
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    18
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    19 Lề trái của sơ đồ lịch
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    18
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    16 A
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    93, chấp nhận tài sản của
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    23 e. g-
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    24

Thí dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
26,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
13,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
15,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
07 và các thành phần phụ của phần
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
0

lưới tản nhiệt

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 Khung dữ liệu
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    32 Tên cột từ dữ liệu sẽ được coi là
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    33 trong lưới tản nhiệt
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    34 Tên cột từ dữ liệu sẽ được coi là
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    35 trong lưới tản nhiệt
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    36 tùy chọn, danh sách các giá trị duy nhất [từ cột lưới tản nhiệt từ dữ liệu]. Theo thứ tự các cột sẽ được tạo trong bản đồ nhiệt. Chấp nhận cả
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    37
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    38 tùy chọn, giống như
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    39 nhưng đối với các hàng
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    40 Tên cột từ dữ liệu để hiển thị cho từng lưới tản nhiệt ô
  •       Title 1:                # Take the shape named "Title 1"
            style:                # CSS like properties only for text
              color: '#ff00000'   # Text color will be red
              font-size: 12       # Setting font-size
              .......
            text: New Title       # Replace its text with "New Title"
    
    3
    • import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      42 là mặc định. Nó không hiển thị bất kỳ văn bản
    • import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      43, hiển thị cột
      import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      44
    • import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      45 hiển thị văn bản tùy chỉnh từ cột
      import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      46
    • import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      47 có thể là bất kỳ hàm/biểu thức nào sử dụng
          source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
          target: output.pptx       # required path to save output as
          change:
            Title 1:                # Take the shape named "Title 1"
              text: New Title       # Replace its text with "New Title"
      
      9 là hàng và
      import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      49
          source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
          target: output.pptx       # required path to save output as
          change:
            Title 1:                # Take the shape named "Title 1"
              text: New Title       # Replace its text with "New Title"
      
      9 [là hàng] và
      import pandas as pd
      from gramex.pptgen import pptgen
      
      data = {'chart_data': pd.read_csv['data.csv']}
      pptgen[
        source='input.pptx',
        target='output.pptx',
        edit_chart={
          'Bar Chart Shape Name': {
            'chart': {
              'data': data['chart_data'],
              'x': 'Category',
              'size': 'PreY',
              'color': {
                'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
              }
            }
          }
        }
      ]
      
      49
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    52 Theo tỷ lệ phần trăm [0-1] của tổng chiều rộng của hình dạng. Lề trái của hình mà từ đó lưới tản nhiệt sẽ bắt đầu được tạo ra
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    53 Chiều rộng của mỗi ô. Mặc định dựa trên chiều rộng cột của hình dạng sẽ được xác định
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    54 Chiều cao của mỗi ô. Mặc định dựa trên số lượng hàng chiều cao của hình dạng sẽ được xác định
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    55 Xử lý đại diện văn bản giá trị
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    56
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    57 Màu ô cho các giá trị
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    56
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    16 tùy chọn
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    93, để áp dụng các thuộc tính css
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    61 Dict like đối tượng hoặc int. Mặc định 5px [trái, phải, trên, dưới]. Nếu
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    62 sẽ đặt phần đệm [trái, phải, trên, dưới] là 10px.
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    63 chấp nhận giá trị
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    64 thô bằng pixel hoặc một
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    65. Biểu thức này có thể sử dụng các tham số
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    49,
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    33,
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    35 và
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    44

Thí dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
32,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
34,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
40 và các thành phần phụ của phần
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
0

Sankey

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 Khung dữ liệu
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    76
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    89 hoặc
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    78 nếu dữ liệu đúng sẽ được sắp xếp trong khi vẽ sankey
  •       Title 1:                # Take the shape named "Title 1"
            style:                # CSS like properties only for text
              color: '#ff00000'   # Text color will be red
              font-size: 12       # Setting font-size
              .......
            text: New Title       # Replace its text with "New Title"
    
    3 Chức năng hiện chữ trong sankey
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    80 Đặt hàng theo nhóm
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    19 Hàm màu dựa trên đó
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    82 Tên cột nhóm từ dữ liệu

Thí dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
57,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
80,
      Title 1:                # Take the shape named "Title 1"
        style:                # CSS like properties only for text
          color: '#ff00000'   # Text color will be red
          font-size: 12       # Setting font-size
          .......
        text: New Title       # Replace its text with "New Title"
3,
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
2

sơ đồ cây

  •     source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
        target: output.pptx       # required path to save output as
        change:
          Title 1:                # Take the shape named "Title 1"
            text: New Title       # Replace its text with "New Title"
    
    1 Khung dữ liệu
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    89 Nhóm tên cột là
    from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    53
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    91 Hàm tổng hợp để áp dụng cho mỗi nhóm
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    57 Chức năng kích thước hộp của Treemap
  • import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    76 Chức năng sắp xếp các hình chữ nhật của treemap dựa trên chức năng
    import pandas as pd
    from gramex.pptgen import pptgen
    
    data = {'chart_data': pd.read_csv['data.csv']}
    pptgen[
      source='input.pptx',
      target='output.pptx',
      edit_chart={
        'Bar Chart Shape Name': {
          'chart': {
            'data': data['chart_data'],
            'x': 'Category',
            'size': 'PreY',
            'color': {
              'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
            }
          }
        }
      }
    ]
    
    94
  • from gramex.pptgen import pptgen
    pptgen[
      source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
      target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
      change={                  # Configurations are same as when loading from the YAML file
        'Title 1': {            # Take the shape named "Title 1"
          'text' 'New Title'    # Replace its text with "New Title"
        }
      }
    ]
    
    19 Khung dữ liệu
  •       Title 1:                # Take the shape named "Title 1"
            style:                # CSS like properties only for text
              color: '#ff00000'   # Text color will be red
              font-size: 12       # Setting font-size
              .......
            text: New Title       # Replace its text with "New Title"
    
    3 Chức năng hiển thị văn bản trong treemap

Thí dụ

Chạy ví dụ

Các phím sau cũng có thể được chỉ định làm hàm an và python.

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
1,
from gramex.pptgen import pptgen
pptgen[
  source='input.pptx',      # optional path to source. Defaults to blank PPT with 1 slide
  target='output.pptx',     # optional target. Otherwise, returns the pptx.Presentation[]
  change={                  # Configurations are same as when loading from the YAML file
    'Title 1': {            # Take the shape named "Title 1"
      'text' 'New Title'    # Replace its text with "New Title"
    }
  }
]
57,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
89,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
91,
import pandas as pd
from gramex.pptgen import pptgen

data = {'chart_data': pd.read_csv['data.csv']}
pptgen[
  source='input.pptx',
  target='output.pptx',
  edit_chart={
    'Bar Chart Shape Name': {
      'chart': {
        'data': data['chart_data'],
        'x': 'Category',
        'size': 'PreY',
        'color': {
          'function': "{'CurY': '#D73027', 'PreY': '#1A9850', 'PPresY': '#FFFFBF', 'Size': '#cccccc'}"
        }
      }
    }
  }
]
94,
    Rectangle 1:            # Take the shape named "Rectangle 1"
      css:
        data: data['sales']
        style:
          opacity: 0.5
          color: '#ff0000'
          fill: '#ffff00'
          stroke: '#ffff00'
          width:  200
          height: 200
          left: 50
          top: 100
2,
source: input.pptx
target: output.pptx
rule-1:                 # rule-1 applies to all slides
  ...
rule-2:
  slide-number: 1       # rule-2 applies only to the first slide of the source
  ...
rule-3:
  slide-title: Hello    # rule-3 applies to slides with the title "Hello" [regex]
  ...
  ...
2

PPTGen sử dụng cấu hình để sửa đổi tệp. Cấu hình xác định

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
04,
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
05,
    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
9 và bất kỳ số quy tắc nào

Trên dòng lệnh, nó chấp nhận tệp YAML làm đầu vào. Ví dụ:

    source: input.pptx        # optional path to source. Default to blank PPT with 1 slide
    target: output.pptx       # required path to save output as
    change:
      Title 1:                # Take the shape named "Title 1"
        text: New Title       # Replace its text with "New Title"
07 này sao chép đầu vào. pptx để xuất. pptx và thay đổi tiêu đề thành “Tiêu đề mới”

Chủ Đề