Skip to main content

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

Project description

PRISM OLE Handler

CI

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)

pip install prism-ole-handler

From source

git clone https://github.com/armish/prism-ole-handler.git
cd prism-ole-handler
pip install -e .

Development installation

pip install -e ".[dev]"

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

Usage

Extraction:

# 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:

# 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:

    prism-extract presentation.pptx -o extracted_files
    
  2. Edit the extracted .pzfx files in GraphPad PRISM

  3. Insert the updated files back into PowerPoint:

    # 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:

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:
git clone https://github.com/armish/prism-ole-handler.git
cd prism-ole-handler
pip install -e ".[dev]"
  1. Install Git hooks for code quality checks:
./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

# 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:

# Format code
black prism_ole_handler/ tests/

# Run tests
python -m pytest tests/ -v

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

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

prism_ole_handler-0.1.1.tar.gz (201.2 kB view details)

Uploaded Source

Built Distribution

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

prism_ole_handler-0.1.1-py3-none-any.whl (193.9 kB view details)

Uploaded Python 3

File details

Details for the file prism_ole_handler-0.1.1.tar.gz.

File metadata

  • Download URL: prism_ole_handler-0.1.1.tar.gz
  • Upload date:
  • Size: 201.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.0

File hashes

Hashes for prism_ole_handler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9899a2419351ff45e08b41d304f1fe2fef56d66fdf4be68ae045edf314fe6b9c
MD5 093acbfd8c6865236bde0b16da368d7a
BLAKE2b-256 99cea0249e49cd5b7b0b03471f45a9c214e29816ec5fb355ecdae078e8bdeb95

See more details on using hashes here.

File details

Details for the file prism_ole_handler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for prism_ole_handler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 612b8cea7523f8af1db59789b1249e1aa2fac779f3fccf72c75e3538c3c9772d
MD5 643c5505c3f58177dfdc65c24fb248b7
BLAKE2b-256 effc8a65a51fbf7127cd5b5f8d828f217e2a36e01375390eba191396a28088b9

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