opencat/filter-pptx 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

opencat/filter-pptx

Composer 安装命令:

composer require opencat/filter-pptx

包简介

PowerPoint (.pptx) file filter for the OpenCAT Framework

README 文档

README

Microsoft PowerPoint PPTX file filter for the CAT Framework.

Installation

composer require catframework/filter-pptx

Requires ext-dom, ext-libxml, and ext-zip.

Usage

use CatFramework\FilterPptx\PptxFilter;

$filter = new PptxFilter();

// Extract translatable segments
$document = $filter->extract('slides.pptx', 'en', 'fr');

foreach ($document->getSegmentPairs() as $pair) {
    $pair->target = new Segment('seg-t', [$translatedText]);
}

// Write the translated PPTX
$filter->rebuild($document, 'slides.fr.pptx');

What gets extracted

Each non-empty <a:p> paragraph in the presentation is one segment. Slide order follows ppt/_rels/presentation.xml.rels, which preserves the authoring application's declared order.

Extracted locations (per slide, in order):

  1. Slide content (ppt/slides/slideN.xml)
  2. Speaker notes (ppt/notesSlides/notesSlideN.xml), if present

Hidden slides (marked show="0" on the root <p:sld> element) are silently skipped.

Adjacent runs with identical DrawingML formatting (<a:rPr>) are merged before extraction. Remaining formatting runs become InlineCode pairs.

RTL support

When the target language is a right-to-left language, rtl="1" is set on each run's <a:rPr> and on the paragraph's <a:pPr> on rebuild.

Supported RTL language prefixes: ar, he, fa, ur, yi, dv, ps, sd.

Skeleton format

The skeleton is a temporary PPTX file written to the system temp directory at extract time:

['path' => '/tmp/cat-<uniqid>.skl']

The skeleton is a copy of the original PPTX ZIP with paragraph content replaced by {{SEG:NNN}} tokens. Do not delete it between extract() and rebuild() calls.

Limitations

  • Charts and SmartArt: text embedded in chart data or SmartArt XML is not extracted.
  • Embedded objects: OLE objects and embedded workbooks are not processed.
  • Skeleton lifetime: the .skl temp file must survive between extract() and rebuild(). For long-lived workflows, persist $document->skeleton['path'].

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固