prism-ole-handler


Nameprism-ole-handler JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/armish/prism-ole-handler
SummaryExtract and insert GraphPad PRISM objects from Microsoft Office documents (PowerPoint, Word, Excel) on macOS
upload_time2025-07-16 01:13:28
maintainerNone
docs_urlNone
authorB. Arman Aksoy
requires_python>=3.9
licenseNone
keywords prism ole handler microsoft office powerpoint word excel macos graphpad
VCS
bugtrack_url
requirements olefile
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PRISM OLE Handler

[![CI](https://github.com/armish/prism-ole-handler/actions/workflows/ci.yml/badge.svg)](https://github.com/armish/prism-ole-handler/actions/workflows/ci.yml)

Extract and insert GraphPad PRISM objects from Microsoft Office documents (PowerPoint, Word, Excel) on macOS.

## Background

Microsoft Office for Mac doesn't support direct editing of embedded PRISM objects (OLE), unlike Windows. This package provides tools to extract embedded PRISM objects from Office documents so they can be edited in PRISM and re-embedded.

Currently supports:
- **PowerPoint** (.pptx) - Full support
- **Word** (.docx) - Planned
- **Excel** (.xlsx) - Planned

## Installation

### From PyPI (recommended)
```bash
pip install prism-ole-handler
```

### From source
```bash
git clone https://github.com/armish/prism-ole-handler.git
cd prism-ole-handler
pip install -e .
```

### Development installation
```bash
pip install -e ".[dev]"

# Install Git hooks for code quality checks
./scripts/install-hooks.sh
```

## Usage

### Extraction:
```bash
# Extract from all slides
prism-extract presentation.pptx -o output_folder

# Extract from specific slide
prism-extract presentation.pptx --slide 2 -o output_folder

# Extract from multiple slides
prism-extract presentation.pptx --slide 2 --slide 3 --slide 5 -o output_folder

# Extract from multiple slides (comma-separated)
prism-extract presentation.pptx --slides 2,3,5 -o output_folder

# Customize filename padding (default is 3 digits)
prism-extract presentation.pptx -o output_folder --padding 2  # slide06_object04_prism.pzfx
prism-extract presentation.pptx -o output_folder --padding 1  # slide6_object4_prism.pzfx
```

This provides:
- Selective extraction by slide number
- Better OLE compound document parsing
- Slide number tracking for each object
- More detailed extraction information

## Output

Extracted files will be saved with descriptive names:
- `slide001_object001.pzfx` - PRISM file from slide 1 (default 3-digit padding)
- `slide02_object01.pzfx` - With 2-digit padding (`--padding 2`)
- `slide2_object1.pzfx` - With 1-digit padding (`--padding 1`)
- `object001_stream_Package.bin` - Extracted OLE stream for investigation

## How it works

1. PPTX files are ZIP archives containing XML and embedded objects
2. Embedded objects are stored in `ppt/embeddings/` as .bin files
3. These .bin files are often OLE compound documents containing PRISM data
4. The tool extracts and identifies PRISM XML data from these containers

## Insertion

To re-insert updated PRISM objects back into PowerPoint:

```bash
# Update an existing slide (replace existing embedding)
prism-insert presentation.pptx --slide 2 --prism updated_graph.pzfx

# Insert into empty slide
prism-insert presentation.pptx --slide 3 --prism new_graph.pzfx

# Create new slide with PRISM object
prism-insert presentation.pptx --slide 10 --prism graph.pzfx --create-new

# Update multiple slides
prism-insert presentation.pptx --slide 2 --prism graph1.pzfx --slide 3 --prism graph2.pzfx

# Add to slides that already have embeddings
prism-insert presentation.pptx --slide 2 --prism additional_graph.pzfx --force-insert
```

The insertion tool:
- **Replaces** existing embeddings by default
- **Inserts** into empty slides automatically
- **Creates new slides** with `--create-new` flag
- **Adds multiple objects** to slides with `--force-insert`
- Creates a backup of the original file
- Updates the OLE containers with new PRISM data
- Preserves the visual representation streams
- Maintains all PowerPoint relationships

## Complete Workflow

1. **Extract PRISM objects from PowerPoint:**
   ```bash
   prism-extract presentation.pptx -o extracted_files
   ```

2. **Edit the extracted .pzfx files in GraphPad PRISM**

3. **Insert the updated files back into PowerPoint:**
   ```bash
   # Replace existing object
   prism-insert presentation.pptx --slide 2 --prism extracted_files/slide2_updated.pzfx
   
   # Add to new slide
   prism-insert presentation.pptx --slide 10 --prism extracted_files/new_graph.pzfx --create-new
   ```

## Python API

You can also use the package programmatically:

```python
from prism_ole_handler import PrismExtractor, PrismInserter

# Extract PRISM objects from PowerPoint
extractor = PrismExtractor("presentation.pptx")
extractor.extract_prism_objects("output_folder", selected_slides=[2, 3])

# Customize filename padding
extractor.extract_prism_objects("output_folder", padding=2)  # slide06_object04_prism.pzfx

# Insert PRISM objects into PowerPoint
inserter = PrismInserter("presentation.pptx")
inserter.insert_prism_object(slide_num=2, prism_file_path="graph.pzfx")
```

## Limitations

- OLE files have size constraints - very large PRISM files may not fit
- Complex OLE structures may require manual investigation
- Visual representation is preserved but may not reflect all changes
- Only `.pzfx` format supported for insertion (not `.prism` files)

## File Format Notes

- **Extraction**: Creates `.pzfx` files that can be opened in PRISM
- **Insertion**: Requires `.pzfx` files (not `.prism` files)
- **Conversion**: Open `.prism` files in PRISM and save as `.pzfx` format

## Development

### Setting up for development

1. Clone the repository and install in editable mode:
```bash
git clone https://github.com/armish/prism-ole-handler.git
cd prism-ole-handler
pip install -e ".[dev]"
```

2. Install Git hooks for code quality checks:
```bash
./scripts/install-hooks.sh
```

### Code Quality

The project uses several tools to maintain code quality:

- **Black**: Code formatting
- **pytest**: Unit testing
- **Git hooks**: Automatic pre-push checks

Before pushing changes, the pre-push hook will automatically:
- Check code formatting with Black
- Run all unit tests  
- Verify package imports

### Running tests locally

```bash
# Run all tests
python -m pytest tests/ -v

# Check code formatting
black --check prism_ole_handler/ tests/

# Auto-fix formatting
black prism_ole_handler/ tests/
```

### Manual quality checks

If you prefer to run checks manually before committing:

```bash
# Format code
black prism_ole_handler/ tests/

# Run tests
python -m pytest tests/ -v

# Verify everything is ready
black --check prism_ole_handler/ tests/
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/armish/prism-ole-handler",
    "name": "prism-ole-handler",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "prism, ole, handler, microsoft, office, powerpoint, word, excel, macos, graphpad",
    "author": "B. Arman Aksoy",
    "author_email": "\"B. Arman Aksoy\" <arman@aksoy.org>",
    "download_url": "https://files.pythonhosted.org/packages/99/ce/a0249e49cd5b7b0b03471f45a9c214e29816ec5fb355ecdae078e8bdeb95/prism_ole_handler-0.1.1.tar.gz",
    "platform": null,
    "description": "# PRISM OLE Handler\n\n[![CI](https://github.com/armish/prism-ole-handler/actions/workflows/ci.yml/badge.svg)](https://github.com/armish/prism-ole-handler/actions/workflows/ci.yml)\n\nExtract and insert GraphPad PRISM objects from Microsoft Office documents (PowerPoint, Word, Excel) on macOS.\n\n## Background\n\nMicrosoft Office for Mac doesn't support direct editing of embedded PRISM objects (OLE), unlike Windows. This package provides tools to extract embedded PRISM objects from Office documents so they can be edited in PRISM and re-embedded.\n\nCurrently supports:\n- **PowerPoint** (.pptx) - Full support\n- **Word** (.docx) - Planned\n- **Excel** (.xlsx) - Planned\n\n## Installation\n\n### From PyPI (recommended)\n```bash\npip install prism-ole-handler\n```\n\n### From source\n```bash\ngit clone https://github.com/armish/prism-ole-handler.git\ncd prism-ole-handler\npip install -e .\n```\n\n### Development installation\n```bash\npip install -e \".[dev]\"\n\n# Install Git hooks for code quality checks\n./scripts/install-hooks.sh\n```\n\n## Usage\n\n### Extraction:\n```bash\n# Extract from all slides\nprism-extract presentation.pptx -o output_folder\n\n# Extract from specific slide\nprism-extract presentation.pptx --slide 2 -o output_folder\n\n# Extract from multiple slides\nprism-extract presentation.pptx --slide 2 --slide 3 --slide 5 -o output_folder\n\n# Extract from multiple slides (comma-separated)\nprism-extract presentation.pptx --slides 2,3,5 -o output_folder\n\n# Customize filename padding (default is 3 digits)\nprism-extract presentation.pptx -o output_folder --padding 2  # slide06_object04_prism.pzfx\nprism-extract presentation.pptx -o output_folder --padding 1  # slide6_object4_prism.pzfx\n```\n\nThis provides:\n- Selective extraction by slide number\n- Better OLE compound document parsing\n- Slide number tracking for each object\n- More detailed extraction information\n\n## Output\n\nExtracted files will be saved with descriptive names:\n- `slide001_object001.pzfx` - PRISM file from slide 1 (default 3-digit padding)\n- `slide02_object01.pzfx` - With 2-digit padding (`--padding 2`)\n- `slide2_object1.pzfx` - With 1-digit padding (`--padding 1`)\n- `object001_stream_Package.bin` - Extracted OLE stream for investigation\n\n## How it works\n\n1. PPTX files are ZIP archives containing XML and embedded objects\n2. Embedded objects are stored in `ppt/embeddings/` as .bin files\n3. These .bin files are often OLE compound documents containing PRISM data\n4. The tool extracts and identifies PRISM XML data from these containers\n\n## Insertion\n\nTo re-insert updated PRISM objects back into PowerPoint:\n\n```bash\n# Update an existing slide (replace existing embedding)\nprism-insert presentation.pptx --slide 2 --prism updated_graph.pzfx\n\n# Insert into empty slide\nprism-insert presentation.pptx --slide 3 --prism new_graph.pzfx\n\n# Create new slide with PRISM object\nprism-insert presentation.pptx --slide 10 --prism graph.pzfx --create-new\n\n# Update multiple slides\nprism-insert presentation.pptx --slide 2 --prism graph1.pzfx --slide 3 --prism graph2.pzfx\n\n# Add to slides that already have embeddings\nprism-insert presentation.pptx --slide 2 --prism additional_graph.pzfx --force-insert\n```\n\nThe insertion tool:\n- **Replaces** existing embeddings by default\n- **Inserts** into empty slides automatically\n- **Creates new slides** with `--create-new` flag\n- **Adds multiple objects** to slides with `--force-insert`\n- Creates a backup of the original file\n- Updates the OLE containers with new PRISM data\n- Preserves the visual representation streams\n- Maintains all PowerPoint relationships\n\n## Complete Workflow\n\n1. **Extract PRISM objects from PowerPoint:**\n   ```bash\n   prism-extract presentation.pptx -o extracted_files\n   ```\n\n2. **Edit the extracted .pzfx files in GraphPad PRISM**\n\n3. **Insert the updated files back into PowerPoint:**\n   ```bash\n   # Replace existing object\n   prism-insert presentation.pptx --slide 2 --prism extracted_files/slide2_updated.pzfx\n   \n   # Add to new slide\n   prism-insert presentation.pptx --slide 10 --prism extracted_files/new_graph.pzfx --create-new\n   ```\n\n## Python API\n\nYou can also use the package programmatically:\n\n```python\nfrom prism_ole_handler import PrismExtractor, PrismInserter\n\n# Extract PRISM objects from PowerPoint\nextractor = PrismExtractor(\"presentation.pptx\")\nextractor.extract_prism_objects(\"output_folder\", selected_slides=[2, 3])\n\n# Customize filename padding\nextractor.extract_prism_objects(\"output_folder\", padding=2)  # slide06_object04_prism.pzfx\n\n# Insert PRISM objects into PowerPoint\ninserter = PrismInserter(\"presentation.pptx\")\ninserter.insert_prism_object(slide_num=2, prism_file_path=\"graph.pzfx\")\n```\n\n## Limitations\n\n- OLE files have size constraints - very large PRISM files may not fit\n- Complex OLE structures may require manual investigation\n- Visual representation is preserved but may not reflect all changes\n- Only `.pzfx` format supported for insertion (not `.prism` files)\n\n## File Format Notes\n\n- **Extraction**: Creates `.pzfx` files that can be opened in PRISM\n- **Insertion**: Requires `.pzfx` files (not `.prism` files)\n- **Conversion**: Open `.prism` files in PRISM and save as `.pzfx` format\n\n## Development\n\n### Setting up for development\n\n1. Clone the repository and install in editable mode:\n```bash\ngit clone https://github.com/armish/prism-ole-handler.git\ncd prism-ole-handler\npip install -e \".[dev]\"\n```\n\n2. Install Git hooks for code quality checks:\n```bash\n./scripts/install-hooks.sh\n```\n\n### Code Quality\n\nThe project uses several tools to maintain code quality:\n\n- **Black**: Code formatting\n- **pytest**: Unit testing\n- **Git hooks**: Automatic pre-push checks\n\nBefore pushing changes, the pre-push hook will automatically:\n- Check code formatting with Black\n- Run all unit tests  \n- Verify package imports\n\n### Running tests locally\n\n```bash\n# Run all tests\npython -m pytest tests/ -v\n\n# Check code formatting\nblack --check prism_ole_handler/ tests/\n\n# Auto-fix formatting\nblack prism_ole_handler/ tests/\n```\n\n### Manual quality checks\n\nIf you prefer to run checks manually before committing:\n\n```bash\n# Format code\nblack prism_ole_handler/ tests/\n\n# Run tests\npython -m pytest tests/ -v\n\n# Verify everything is ready\nblack --check prism_ole_handler/ tests/\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Extract and insert GraphPad PRISM objects from Microsoft Office documents (PowerPoint, Word, Excel) on macOS",
    "version": "0.1.1",
    "project_urls": {
        "Bug Reports": "https://github.com/armish/prism-ole-handler/issues",
        "Homepage": "https://github.com/armish/prism-ole-handler",
        "Source": "https://github.com/armish/prism-ole-handler"
    },
    "split_keywords": [
        "prism",
        " ole",
        " handler",
        " microsoft",
        " office",
        " powerpoint",
        " word",
        " excel",
        " macos",
        " graphpad"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "effc8a65a51fbf7127cd5b5f8d828f217e2a36e01375390eba191396a28088b9",
                "md5": "643c5505c3f58177dfdc65c24fb248b7",
                "sha256": "612b8cea7523f8af1db59789b1249e1aa2fac779f3fccf72c75e3538c3c9772d"
            },
            "downloads": -1,
            "filename": "prism_ole_handler-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "643c5505c3f58177dfdc65c24fb248b7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 193885,
            "upload_time": "2025-07-16T01:13:27",
            "upload_time_iso_8601": "2025-07-16T01:13:27.888036Z",
            "url": "https://files.pythonhosted.org/packages/ef/fc/8a65a51fbf7127cd5b5f8d828f217e2a36e01375390eba191396a28088b9/prism_ole_handler-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "99cea0249e49cd5b7b0b03471f45a9c214e29816ec5fb355ecdae078e8bdeb95",
                "md5": "093acbfd8c6865236bde0b16da368d7a",
                "sha256": "9899a2419351ff45e08b41d304f1fe2fef56d66fdf4be68ae045edf314fe6b9c"
            },
            "downloads": -1,
            "filename": "prism_ole_handler-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "093acbfd8c6865236bde0b16da368d7a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 201235,
            "upload_time": "2025-07-16T01:13:28",
            "upload_time_iso_8601": "2025-07-16T01:13:28.923035Z",
            "url": "https://files.pythonhosted.org/packages/99/ce/a0249e49cd5b7b0b03471f45a9c214e29816ec5fb355ecdae078e8bdeb95/prism_ole_handler-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 01:13:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "armish",
    "github_project": "prism-ole-handler",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "olefile",
            "specs": [
                [
                    ">=",
                    "0.46"
                ]
            ]
        }
    ],
    "lcname": "prism-ole-handler"
}
        
Elapsed time: 0.44227s