Skip to main content

Insert WPS in-cell images into XLSX by editing OOXML parts

Project description

ce_img_ll

中文说明

ce_img_ll 通过修改 XLSX 底层 OOXML 部件,把图片以 WPS 单元格内图片(DISPIMG + cellimages.xml)方式写入指定单元格。

功能特性

  • 统一接口 insert_image
  • 默认推荐使用行列定位(position_image_map)。
  • 同时支持 A1 引用(cell_image_map)兼容旧调用。
  • 保留工作簿结构,输出采用原子写入。

安装

pip install ce_img_ll

Python 用法

推荐(行列方式):

from pathlib import Path
from ce_img_ll import insert_image

insert_image(
    source_xlsx=Path("input.xlsx"),
    output_xlsx=Path("output.xlsx"),
    sheet_name="Sheet1",
    position_image_map={
        (2, 14): Path("a.png"),
        (3, 14): Path("b.png"),
    },
)

兼容(A1 方式):

from pathlib import Path
from ce_img_ll import insert_image

insert_image(
    source_xlsx=Path("input.xlsx"),
    output_xlsx=Path("output.xlsx"),
    sheet_name="Sheet1",
    cell_image_map={
        "N2": Path("a.png"),
        "N3": Path("b.png"),
    },
)

CLI 用法

推荐(行列方式):

ce-img-ll --source-xlsx input.xlsx --output-xlsx out.xlsx --sheet Sheet1 --rc 2,14=a.png --rc 3,14=b.png

兼容(A1 方式):

ce-img-ll --source-xlsx input.xlsx --output-xlsx out.xlsx --sheet Sheet1 --pair N2=a.png --pair N3=b.png

English Documentation

ce_img_ll inserts images into .xlsx cells using WPS-specific in-cell image mechanics by editing OOXML parts directly (DISPIMG + cellimages.xml).

Features

  • Unified API: insert_image.
  • Preferred/default input is row+column mapping (position_image_map).
  • A1 mapping (cell_image_map) is still supported for compatibility.
  • Preserves workbook structure and writes output atomically.

Installation

pip install ce_img_ll

Python Usage

Preferred (row/col mode):

from pathlib import Path
from ce_img_ll import insert_image

insert_image(
    source_xlsx=Path("input.xlsx"),
    output_xlsx=Path("output.xlsx"),
    sheet_name="Sheet1",
    position_image_map={
        (2, 14): Path("a.png"),
        (3, 14): Path("b.png"),
    },
)

Compatibility (A1 mode):

from pathlib import Path
from ce_img_ll import insert_image

insert_image(
    source_xlsx=Path("input.xlsx"),
    output_xlsx=Path("output.xlsx"),
    sheet_name="Sheet1",
    cell_image_map={
        "N2": Path("a.png"),
        "N3": Path("b.png"),
    },
)

CLI Usage

Preferred (row/col mode):

ce-img-ll --source-xlsx input.xlsx --output-xlsx out.xlsx --sheet Sheet1 --rc 2,14=a.png --rc 3,14=b.png

Compatibility (A1 mode):

ce-img-ll --source-xlsx input.xlsx --output-xlsx out.xlsx --sheet Sheet1 --pair N2=a.png --pair N3=b.png

Project details


Download files

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

Source Distribution

ce_img_ll-0.3.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ce_img_ll-0.3.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file ce_img_ll-0.3.0.tar.gz.

File metadata

  • Download URL: ce_img_ll-0.3.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for ce_img_ll-0.3.0.tar.gz
Algorithm Hash digest
SHA256 3b1503fa794654dc158a6b889c1c850fc86cf8cc5efd1d64b92753175a55c147
MD5 3a7b99e05bd8ca8319d9c3c0815dcea1
BLAKE2b-256 249d83e470278dff154591d527f5ecba41c58d19b8639e09762e7a1cf08c5c6e

See more details on using hashes here.

File details

Details for the file ce_img_ll-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: ce_img_ll-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for ce_img_ll-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 901eef4c14a584ece9fd5cd4d926143004f910f126dba29ea18b9af510c9ccc6
MD5 9e11ee89434f16b13b9d977eba4145dc
BLAKE2b-256 650943e98675d32beb3d7cf1c3da8dfdaf2011df9019fc30eb05468595d111db

See more details on using hashes here.

Supported by

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