Metadata-Version: 2.4
Name: ce_img_ll
Version: 0.3.0
Summary: Insert WPS in-cell images into XLSX by editing OOXML parts
Author: Zeaulo
License-Expression: MIT
Project-URL: Homepage, https://github.com/Zeaulo
Project-URL: Repository, https://github.com/Zeaulo/ce_img_ll
Project-URL: Issues, https://github.com/Zeaulo/ce_img_ll/issues
Project-URL: Author, https://github.com/Zeaulo
Keywords: xlsx,wps,spreadsheet,ooxml,image
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

﻿# ce_img_ll

## 中文说明

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

### 功能特性
- 统一接口 `insert_image`。
- 默认推荐使用行列定位（`position_image_map`）。
- 同时支持 A1 引用（`cell_image_map`）兼容旧调用。
- 保留工作簿结构，输出采用原子写入。

### 安装

```bash
pip install ce_img_ll
```

### Python 用法

推荐（行列方式）：

```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 方式）：

```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",
    cell_image_map={
        "N2": Path("a.png"),
        "N3": Path("b.png"),
    },
)
```

### CLI 用法

推荐（行列方式）：

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

兼容（A1 方式）：

```bash
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

```bash
pip install ce_img_ll
```

### Python Usage

Preferred (row/col mode):

```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"),
    },
)
```

Compatibility (A1 mode):

```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",
    cell_image_map={
        "N2": Path("a.png"),
        "N3": Path("b.png"),
    },
)
```

### CLI Usage

Preferred (row/col mode):

```bash
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):

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