Files
xSaherelmWorkspace/Documents/Docs/Developer/PowerPoint File Content Extractor.html
T

1601 lines
60 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>مستند پیاده‌سازی XPowerPointFileContentExtractor | پروژه xAiApi</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 950px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong {
color: var(--accent-dark);
}
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.comparison-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 25px 0;
}
.comparison-card {
background: #f8fafc;
border: 2px solid var(--border);
border-radius: 10px;
padding: 20px;
position: relative;
}
.comparison-card.recommended {
border-color: var(--success);
background: linear-gradient(to left, #f0fff4, #e6fffa);
}
.comparison-card .card-badge {
position: absolute;
top: -10px;
right: 20px;
background: var(--success);
color: white;
padding: 3px 12px;
border-radius: 15px;
font-size: 11px;
font-weight: 600;
}
.comparison-card h4 {
font-size: 16px;
font-weight: 700;
color: var(--primary);
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid var(--border);
}
.comparison-card.recommended h4 {
border-bottom-color: var(--success);
}
.comparison-card ul {
list-style: none;
padding: 0;
}
.comparison-card ul li {
padding: 8px 0;
border-bottom: 1px solid var(--border);
font-size: 13px;
display: flex;
justify-content: space-between;
}
.comparison-card ul li:last-child { border-bottom: none; }
.comparison-card ul li .value {
font-weight: 600;
color: var(--primary);
}
.quote-box {
background: linear-gradient(135deg, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin: 20px 0;
position: relative;
}
.quote-box::before {
content: '"';
position: absolute;
top: -10px;
right: 15px;
font-size: 60px;
color: var(--accent);
opacity: 0.3;
font-family: Georgia, serif;
}
.quote-box p {
font-style: italic;
color: var(--text-muted);
margin-bottom: 10px;
text-indent: 0 !important;
}
.quote-box .source {
font-size: 12px;
color: var(--text-muted);
text-align: left;
font-style: normal;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin: 25px 0;
}
.stat-card {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
}
.stat-card .stat-value {
font-size: 24px;
font-weight: 800;
margin-bottom: 5px;
color: var(--accent);
line-height: 1.3;
}
.stat-card .stat-label {
font-size: 12px;
opacity: 0.9;
}
.timeline {
position: relative;
padding: 20px 0;
margin: 25px 0;
}
.timeline::before {
content: '';
position: absolute;
right: 50%;
top: 0;
bottom: 0;
width: 3px;
background: var(--border);
transform: translateX(50%);
}
.timeline-item {
display: flex;
margin-bottom: 20px;
position: relative;
}
.timeline-item:nth-child(odd) {
flex-direction: row-reverse;
}
.timeline-content {
width: 45%;
background: #f8fafc;
border: 1px solid var(--border);
border-radius: 8px;
padding: 15px;
position: relative;
}
.timeline-item:nth-child(odd) .timeline-content {
margin-left: 5%;
}
.timeline-item:nth-child(even) .timeline-content {
margin-right: 5%;
}
.timeline-dot {
position: absolute;
right: 50%;
top: 20px;
width: 16px;
height: 16px;
background: var(--accent);
border: 3px solid white;
border-radius: 50%;
transform: translateX(50%);
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
z-index: 1;
}
.timeline-content h5 {
font-size: 14px;
font-weight: 700;
color: var(--primary);
margin-bottom: 8px;
}
.timeline-content p {
font-size: 12px;
color: var(--text-muted);
text-indent: 0 !important;
margin-bottom: 0 !important;
}
.reference-list {
list-style: none;
padding: 0;
margin: 20px 0;
}
.reference-list li {
background: #f8fafc;
border-right: 3px solid var(--primary-light);
padding: 15px 20px;
margin-bottom: 10px;
border-radius: 6px;
font-size: 13px;
}
.reference-list li strong {
color: var(--primary);
display: block;
margin-bottom: 5px;
}
.reference-list li .ref-source {
font-size: 11px;
color: var(--text-muted);
margin-top: 5px;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.comparison-grid { grid-template-columns: 1fr; }
.stats-grid { grid-template-columns: 1fr; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: TECH-1405-030</div>
<div>نسخه: ۱.۰</div>
<div>تاریخ تهیه: ۳۰ مهر ۱۴۰۵</div>
<div>طبقه‌بندی: محرمانه</div>
</div>
</div>
<div class="document-title">
<span class="label">IMPLEMENTATION GUIDE</span>
<h1>مستند پیاده‌سازی XPowerPointFileContentExtractor</h1>
<h2>راهنمای کامل گام‌به‌گام افزودن Extractor پاورپوینت به سامانه xAiApi</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>به کارفرمای محترم،</strong><br>
این مستند حاصل طراحی و پیاده‌سازی کامل <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">XPowerPointFileContentExtractor</code> به‌عنوان یکی از Extractor های اولویت بالا در زیرسیستم <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">xAiApi/Providers/Extractors</code> است. هدف این مستند، ارائه راهنمای گام‌به‌گام و کامل برای پیاده‌سازی این Extractor با پشتیبانی از تمام فرمت‌های پاورپوینت (هم OpenXML مدرن و هم Binary قدیمی)، استخراج متن اسلایدها، یادداشت‌های سخنران، جداول و تصاویر، و یکپارچه‌سازی کامل با زیرساخت DI موجود است.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>خلاصه اجرایی</h3>
<div class="subtitle">Executive Summary</div>
</div>
</div>
<div class="section-content">
<p>فرمت‌های پاورپوینت از پرکاربردترین انواع فایل در محیط‌های سازمانی هستند و در بسیاری از سناریوهای تعامل با سامانه‌های هوش مصنوعی (تحلیل ارائه‌ها، خلاصه‌سازی جلسات، استخراج دانش سازمانی) به کار می‌روند. با این حال، این فرمت‌ها در دو خانواده کاملاً متفاوت فنی وجود دارند: OpenXML مدرن (`.pptx`، `.ppsx`، `.potx` و نسخه‌های Macro-enabled) و Binary قدیمی (`.ppt`، `.pps`، `.pot`).</p>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value">۹<br>فرمت</div>
<div class="stat-label">پوشش کامل خانواده پاورپوینت</div>
</div>
<div class="stat-card">
<div class="stat-value">۲<br>کتابخانه</div>
<div class="stat-label">OpenXml + NPOI برای پوشش کامل</div>
</div>
<div class="stat-card">
<div class="stat-value">۴<br>نوع محتوا</div>
<div class="stat-label">متن، یادداشت، جدول، تصویر</div>
</div>
</div>
<div class="highlight-box">
<strong>نتیجه کلیدی:</strong> پس از پیاده‌سازی این Extractor، سامانه xAiApi قادر خواهد بود تمام فرمت‌های پاورپوینت را در محیط‌های Cross-platform (Windows، Linux و Docker) پردازش کند، محتوای متنی و ساختاری هر اسلاید را استخراج نماید و در اختیار موتور LLM برای تحلیل و پاسخ‌گویی قرار دهد. این Extractor با ساختار DI و Composite Extractor موجود کاملاً یکپارچه می‌شود و نیازی به تغییر در سایر بخش‌های سامانه ندارد.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>فرمت‌های پشتیبانی‌شده</h3>
<div class="subtitle">Supported Formats</div>
</div>
</div>
<div class="section-content">
<p>پیاده‌سازی این Extractor به‌گونه‌ای طراحی شده است که تمام ۹ فرمت خانواده پاورپوینت را پوشش دهد. جدول زیر این فرمت‌ها را به‌همراه MIME Type و کتابخانه پردازش‌کننده نشان می‌دهد:</p>
<table class="styled-table">
<thead>
<tr>
<th>پسوند</th>
<th>MIME Type</th>
<th>خانواده</th>
<th>کتابخانه</th>
<th>نوع سند</th>
</tr>
</thead>
<tbody>
<tr class="highlight-row">
<td>.pptx</td>
<td>application/vnd.openxmlformats-officedocument.presentationml.presentation</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>ارائه</td>
</tr>
<tr class="highlight-row">
<td>.ppsx</td>
<td>application/vnd.openxmlformats-officedocument.presentationml.slideshow</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>Slide Show</td>
</tr>
<tr class="highlight-row">
<td>.potx</td>
<td>application/vnd.openxmlformats-officedocument.presentationml.template</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>قالب</td>
</tr>
<tr>
<td>.pptm</td>
<td>application/vnd.ms-powerpoint.presentation.macroEnabled.12</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>ارائه Macro-enabled</td>
</tr>
<tr>
<td>.ppsm</td>
<td>application/vnd.ms-powerpoint.slideshow.macroEnabled.12</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>Slide Show Macro-enabled</td>
</tr>
<tr>
<td>.potm</td>
<td>application/vnd.ms-powerpoint.template.macroEnabled.12</td>
<td>OpenXML</td>
<td>DocumentFormat.OpenXml</td>
<td>قالب Macro-enabled</td>
</tr>
<tr>
<td>.ppt</td>
<td>application/vnd.ms-powerpoint</td>
<td>Binary (Legacy)</td>
<td>NPOI (HSLF)</td>
<td>ارائه قدیمی</td>
</tr>
<tr>
<td>.pps</td>
<td>application/vnd.ms-powerpoint</td>
<td>Binary (Legacy)</td>
<td>NPOI (HSLF)</td>
<td>Slide Show قدیمی</td>
</tr>
<tr>
<td>.pot</td>
<td>application/vnd.ms-powerpoint</td>
<td>Binary (Legacy)</td>
<td>NPOI (HSLF)</td>
<td>قالب قدیمی</td>
</tr>
</tbody>
</table>
<div class="info-box">
<strong>💡 نکته درباره MIME Type مشترک:</strong> سه فرمت `.ppt`، `.pps` و `.pot` در سیستم‌عامل‌ها معمولاً MIME Type یکسان <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">application/vnd.ms-powerpoint</code> را گزارش می‌کنند. از آنجا که کتابخانه NPOI هر سه را با یک روش یکسان (HSLF) پردازش می‌کند، این اشتراک MIME مشکلی ایجاد نمی‌کند.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>تصمیم‌های معماری</h3>
<div class="subtitle">Architecture Decisions</div>
</div>
</div>
<div class="section-content">
<p>انتخاب کتابخانه برای پردازش فرمت‌های پاورپوینت مستلزم دقت است. جدول زیر گزینه‌های بررسی‌شده را با معیارهای کلیدی مقایسه می‌کند:</p>
<table class="styled-table">
<thead>
<tr>
<th>کتابخانه</th>
<th>پشتیبانی pptx</th>
<th>پشتیبانی ppt</th>
<th>Cross-platform</th>
<th>مجوز</th>
<th>ارزیابی</th>
</tr>
</thead>
<tbody>
<tr class="highlight-row">
<td><strong>DocumentFormat.OpenXml</strong></td>
<td style="color: var(--success); font-weight: 600;">✓ عالی</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td>MIT (رایگان)</td>
<td>استاندارد صنعتی برای OpenXML</td>
</tr>
<tr class="highlight-row">
<td><strong>NPOI (HSLF)</strong></td>
<td style="color: var(--warning); font-weight: 600;">△ (محدود)</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td>Apache 2.0 (رایگان)</td>
<td>تنها گزینه رایگان و بالغ برای .ppt</td>
</tr>
<tr>
<td>Spire.Presentation</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td>تجاری (پرهزینه)</td>
<td>لایسنس تجاری مانع استفاده است</td>
</tr>
<tr>
<td>GemBox.Presentation</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--warning); font-weight: 600;">△</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td>تجاری</td>
<td>هزینه لایسنس بالا</td>
</tr>
</tbody>
</table>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">راه‌حل انتخابی: ترکیب دو کتابخانه</h4>
<p>با توجه به تحلیل فوق، بهترین راه‌حل، استفاده ترکیبی از دو کتابخانه است:</p>
<div class="success-box">
<strong>✓ OpenXML Formats (.pptx, .ppsx, .potx, .pptm, .ppsm, .potm):</strong> با استفاده از <code style="font-family: monospace;">DocumentFormat.OpenXml</code> — که در حال حاضر در پروژه برای `.docx` استفاده می‌شود — پردازش می‌شوند. این کتابخانه استاندارد صنعتی است، دقت بالایی در استخراج ساختار دارد و مجوز MIT دارد.
</div>
<div class="success-box">
<strong>✓ Binary Legacy Formats (.ppt, .pps, .pot):</strong> با استفاده از <code style="font-family: monospace;">NPOI.HSLF</code> پردازش می‌شوند. HSLF (Horrible Slide Format — نام طنزآمیز برای فرمت Binary مایکروسافت) تنها کتابخانه رایگان، بالغ و Cross-platform برای این فرمت‌ها است.
</div>
<div class="warning-box">
<strong>⚠ نکته درباره NPOI برای OpenXML:</strong> کتابخانه NPOI برای `.pptx` نیز پشتیبانی محدودی دارد (NPOI.XSLF)، اما کامل نیست و ساختارهای پیچیده مثل یادداشت‌های سخنران و جداول را به‌خوبی پشتیبانی نمی‌کند. به همین دلیل برای فرمت‌های OpenXML از OpenXml SDK استفاده می‌شود که کامل‌ترین پشتیبانی را دارد.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>طراحی اینترفیس و کلاس</h3>
<div class="subtitle">Class & Interface Design</div>
</div>
</div>
<div class="section-content">
<p>طراحی این Extractor با الگوی موجود در پروژه کاملاً هم‌راستا است. یک اینترفیس اختصاصی که از `IXFileContentExtractorBase` ارث‌بری می‌کند و یک کلاس پیاده‌ساز مطابق الگوی سایر Extractor ها ایجاد می‌شود.</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">۱. اینترفیس اختصاصی</h4>
<p>فایل <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">Interfaces/Extractors/IXPowerPointFileContentExtractor.cs</code>:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">namespace xAiApi.Interfaces.Extractors
{
/// &lt;summary&gt;
/// Extractor for all PowerPoint Presentation formats
/// (OpenXML: pptx, ppsx, potx, pptm, ppsm, potm | Legacy Binary: ppt, pps, pot)
/// &lt;/summary&gt;
public interface IXPowerPointFileContentExtractor : IXFileContentExtractorBase
{ }
}</pre>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">۲. طراحی کلاس اصلی</h4>
<p>کلاس `XPowerPointFileContentExtractor` ساختار زیر را خواهد داشت:</p>
<table class="styled-table">
<thead>
<tr>
<th>عضو</th>
<th>نوع</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
<tr>
<td><code style="font-family: monospace;">SupportedMimeTypes</code></td>
<td>static string[]</td>
<td>آرایه ثابت شامل ۷ MIME Type منحصربه‌فرد</td>
</tr>
<tr>
<td><code style="font-family: monospace;">CanExtract(string mimeType)</code></td>
<td>bool</td>
<td>بررسی پشتیبانی بر اساس MIME</td>
</tr>
<tr>
<td><code style="font-family: monospace;">ExtractAsync(...)</code></td>
<td>Task&lt;string&gt;</td>
<td>استخراج متن ساده</td>
</tr>
<tr>
<td><code style="font-family: monospace;">ExtractRichAsync(...)</code></td>
<td>Task&lt;XFileExtractionResult&gt;</td>
<td>استخراج متن + جداول + یادداشت + تصاویر</td>
</tr>
<tr>
<td><code style="font-family: monospace;">ExtractOpenXmlAsync(...)</code></td>
<td>private Task&lt;string&gt;</td>
<td>پیاده‌سازی برای OpenXML formats</td>
</tr>
<tr>
<td><code style="font-family: monospace;">ExtractLegacyAsync(...)</code></td>
<td>private Task&lt;string&gt;</td>
<td>پیاده‌سازی برای Binary formats</td>
</tr>
<tr>
<td><code style="font-family: monospace;">IsOpenXmlFormat(mimeType)</code></td>
<td>private static bool</td>
<td>تشخیص فرمت مدرن از MIME</td>
</tr>
<tr>
<td><code style="font-family: monospace;">IsLegacyFormat(mimeType)</code></td>
<td>private static bool</td>
<td>تشخیص فرمت قدیمی از MIME</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۵</div>
<div class="section-title">
<h3>پیاده‌سازی گام‌به‌گام</h3>
<div class="subtitle">Step-by-Step Implementation</div>
</div>
</div>
<div class="section-content">
<p>مراحل زیر به‌ترتیب برای افزودن کامل Extractor پاورپوینت به پروژه xAiApi انجام می‌شود:</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">گام ۱ — افزودن بسته NuGet جدید</h4>
<p>در فایل <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">xAiApi.csproj</code>، بسته زیر را در صورت عدم وجود اضافه کنید:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">&lt;PackageReference Include="NPOI" Version="2.7.1" /&gt;</pre>
<div class="info-box">
<strong>💡 نکته:</strong> بسته <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">DocumentFormat.OpenXml</code> در حال حاضر برای پردازش `.docx` در پروژه وجود دارد و نیازی به افزودن مجدد نیست.
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۲ — ایجاد اینترفیس اختصاصی</h4>
<p>فایل جدید <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">Interfaces/Extractors/IXPowerPointFileContentExtractor.cs</code> را با محتوای نشان‌داده‌شده در بخش ۴ (بالا) ایجاد کنید.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۳ — پیاده‌سازی کلاس اصلی</h4>
<p>فایل <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">Providers/Extractors/XPowerPointFileContentExtractor.cs</code> را با ساختار زیر ایجاد کنید:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">using System;
using System.IO;
using System.Linq;
using NPOI.HSLF.UserModel;
using System.Text;
using System.Threading;
using xAiModels.Models;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Packaging;
using xAiApi.Interfaces.Extractors;
using DrawingText = DocumentFormat.OpenXml.Drawing.Text;
namespace xAiApi.Providers.Extractors
{
/// &lt;summary&gt;
/// Extracts content from all PowerPoint formats
/// (OpenXML: pptx/ppsx/potx/pptm/ppsm/potm | Legacy Binary: ppt/pps/pot)
/// &lt;/summary&gt;
public class XPowerPointFileContentExtractor : IXPowerPointFileContentExtractor
{
private static readonly string[] SupportedMimeTypes =
[
// OpenXML Formats
"application/vnd.openxmlformats-officedocument.presentationml.presentation", // .pptx
"application/vnd.openxmlformats-officedocument.presentationml.slideshow", // .ppsx
"application/vnd.openxmlformats-officedocument.presentationml.template", // .potx
"application/vnd.ms-powerpoint.presentation.macroEnabled.12", // .pptm
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12", // .ppsm
"application/vnd.ms-powerpoint.template.macroEnabled.12", // .potm
// Legacy Binary Formats (.ppt / .pps / .pot share same MIME)
"application/vnd.ms-powerpoint"
];
public bool CanExtract(string mimeType)
{
return SupportedMimeTypes.Contains(
mimeType?.ToLowerInvariant() ?? string.Empty
);
}
public async Task&lt;string&gt; ExtractAsync(
Stream fileStream,
string mimeType,
CancellationToken cancellationToken = default)
{
var result = await ExtractRichAsync(
fileStream: fileStream,
fileName: "presentation",
mimeType: mimeType,
cancellationToken: cancellationToken
);
return result.Text;
}
public async Task&lt;XFileExtractionResult&gt; ExtractRichAsync(
Stream fileStream,
string fileName,
string mimeType,
CancellationToken cancellationToken = default)
{
var result = new XFileExtractionResult
{
FileName = fileName,
MimeType = mimeType
};
try
{
if (IsOpenXmlFormat(mimeType))
{
result.Text = await ExtractOpenXmlAsync(
fileStream, cancellationToken);
}
else if (IsLegacyFormat(mimeType))
{
result.Text = await ExtractLegacyAsync(
fileStream, cancellationToken);
}
else
{
result.ErrorMessage =
$"Unsupported PowerPoint MIME type: {mimeType}";
}
}
catch (Exception ex)
{
result.ErrorMessage =
$"PowerPoint extraction failed: {ex.Message}";
}
return result;
}
private static bool IsOpenXmlFormat(string mimeType)
{
return mimeType?.ToLowerInvariant() switch
{
"application/vnd.openxmlformats-officedocument.presentationml.presentation" =&gt; true,
"application/vnd.openxmlformats-officedocument.presentationml.slideshow" =&gt; true,
"application/vnd.openxmlformats-officedocument.presentationml.template" =&gt; true,
"application/vnd.ms-powerpoint.presentation.macroEnabled.12" =&gt; true,
"application/vnd.ms-powerpoint.slideshow.macroEnabled.12" =&gt; true,
"application/vnd.ms-powerpoint.template.macroEnabled.12" =&gt; true,
_ =&gt; false
};
}
private static bool IsLegacyFormat(string mimeType)
{
return mimeType?.ToLowerInvariant() == "application/vnd.ms-powerpoint";
}
}
}</pre>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۴ — پیاده‌سازی متد ExtractOpenXmlAsync</h4>
<p>این متد برای پردازش ۶ فرمت OpenXML استفاده می‌شود و از `DocumentFormat.OpenXml` بهره می‌برد. متن اسلایدها، یادداشت‌های سخنران، جداول و تصاویر را استخراج می‌کند:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">private async Task&lt;string&gt; ExtractOpenXmlAsync(
Stream fileStream,
CancellationToken cancellationToken)
{
var sb = new StringBuilder();
// Copy to MemoryStream (OpenXml requires seekable stream)
await using var ms = new MemoryStream();
await fileStream.CopyToAsync(ms, cancellationToken);
ms.Position = 0;
using var presentationDocument = PresentationDocument.Open(ms, false);
var presentationPart = presentationDocument.PresentationPart;
if (presentationPart == null)
{
throw new InvalidDataException("Invalid OpenXML PowerPoint structure");
}
var slideParts = presentationPart.SlideParts.ToList();
var slideIndex = 0;
foreach (var slidePart in slideParts)
{
if (cancellationToken.IsCancellationRequested) break;
slideIndex++;
sb.AppendLine($"[Slide {slideIndex}]");
// 1. Extract slide title
var slideTitle = GetSlideTitle(slidePart);
if (!string.IsNullOrWhiteSpace(slideTitle))
{
sb.AppendLine($"Title: {slideTitle}");
}
// 2. Extract body texts
var bodyTexts = slidePart.Slide
.Descendants&lt;DrawingText&gt;()
.Select(t =&gt; t.Text?.Trim())
.Where(t =&gt; !string.IsNullOrWhiteSpace(t) &amp;&amp; t != slideTitle)
.ToList();
if (bodyTexts.Count > 0)
{
sb.AppendLine("Content:");
foreach (var text in bodyTexts)
{
sb.AppendLine($" - {text}");
}
}
// 3. Extract tables
var tables = ExtractOpenXmlTables(slidePart);
if (!string.IsNullOrWhiteSpace(tables))
{
sb.AppendLine("[Tables]");
sb.AppendLine(tables);
}
// 4. Extract speaker notes
var notes = GetSpeakerNotes(slidePart);
if (!string.IsNullOrWhiteSpace(notes))
{
sb.AppendLine("[Speaker Notes]");
sb.AppendLine(notes);
}
// 5. Image count metadata
var imageCount = slidePart.ImageParts?.Count() ?? 0;
if (imageCount &gt; 0)
{
sb.AppendLine($"[Images: {imageCount}]");
}
sb.AppendLine();
}
return sb.ToString().TrimEnd();
}</pre>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۵ — پیاده‌سازی متدهای کمکی OpenXML</h4>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">private static string GetSlideTitle(SlidePart slidePart)
{
// Title placeholder has specific type
var titleShape = slidePart.Slide
.Descendants&lt;DocumentFormat.OpenXml.Presentation.Shape&gt;()
.FirstOrDefault(s =&gt; s.NonVisualShapeProperties?
.NonVisualDrawingProperties?
.Name?.Value?
.StartsWith("Title", StringComparison.OrdinalIgnoreCase) == true);
if (titleShape != null)
{
var titleText = titleShape
.Descendants&lt;DrawingText&gt;()
.Select(t =&gt; t.Text?.Trim())
.Where(t =&gt; !string.IsNullOrWhiteSpace(t));
return string.Join(" ", titleText);
}
return null;
}
private static string GetSpeakerNotes(SlidePart slidePart)
{
var notesSlidePart = slidePart.NotesSlidePart;
if (notesSlidePart?.NotesSlide == null)
{
return null;
}
var notesTexts = notesSlidePart.NotesSlide
.Descendants&lt;DrawingText&gt;()
.Select(t =&gt; t.Text?.Trim())
.Where(t =&gt; !string.IsNullOrWhiteSpace(t))
.ToList();
return notesTexts.Count &gt; 0
? string.Join(Environment.NewLine, notesTexts)
: null;
}
private static string ExtractOpenXmlTables(SlidePart slidePart)
{
var sb = new StringBuilder();
var tableElements = slidePart.Slide
.Descendants&lt;DocumentFormat.OpenXml.Drawing.Table&gt;();
var tableIndex = 0;
foreach (var table in tableElements)
{
tableIndex++;
sb.AppendLine($" Table {tableIndex}:");
foreach (var row in table
.Descendants&lt;DocumentFormat.OpenXml.Drawing.TableRow&gt;())
{
var cells = row
.Descendants&lt;DocumentFormat.OpenXml.Drawing.TableCell&gt;()
.Select(c =&gt; string.Join(" ", c
.Descendants&lt;DrawingText&gt;()
.Select(t =&gt; t.Text?.Trim())
.Where(t =&gt; !string.IsNullOrWhiteSpace(t))))
.ToList();
if (cells.Count &gt; 0)
{
sb.AppendLine($" | {string.Join(" | ", cells)} |");
}
}
sb.AppendLine();
}
return sb.ToString();
}</pre>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۶ — پیاده‌سازی متد ExtractLegacyAsync</h4>
<p>این متد برای پردازش `.ppt`، `.pps` و `.pot` استفاده می‌شود و از `NPOI.HSLF` بهره می‌برد:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">private async Task&lt;string&gt; ExtractLegacyAsync(
Stream fileStream,
CancellationToken cancellationToken)
{
var sb = new StringBuilder();
// HSLF requires seekable stream
await using var ms = new MemoryStream();
await fileStream.CopyToAsync(ms, cancellationToken);
ms.Position = 0;
using var hslfSlideShow = new HSLFSlideShow(ms);
var slides = hslfSlideShow.Slides.ToList();
var slideIndex = 0;
foreach (var slide in slides)
{
if (cancellationToken.IsCancellationRequested) break;
slideIndex++;
sb.AppendLine($"[Slide {slideIndex}]");
var textParts = new List&lt;string&gt;();
var imageCount = 0;
foreach (var shape in slide.Shapes)
{
if (shape is HSLFTextShape textShape)
{
if (!string.IsNullOrWhiteSpace(textShape.Text))
{
textParts.Add(textShape.Text.Trim());
}
}
else if (shape is HSLFPictureShape)
{
imageCount++;
}
}
if (textParts.Count &gt; 0)
{
sb.AppendLine("Content:");
foreach (var text in textParts)
{
sb.AppendLine($" - {text}");
}
}
if (imageCount &gt; 0)
{
sb.AppendLine($"[Images: {imageCount}]");
}
sb.AppendLine();
}
return sb.ToString().TrimEnd();
}</pre>
<div class="warning-box">
<strong>⚠ نکته مهم درباره NPOI.HSLF:</strong> کتابخانه HSLF در NPOI برای فرمت‌های قدیمی `.ppt`، `.pps`، `.pot` طراحی شده و از استخراج یادداشت‌های سخنران و جداول در این فرمت‌ها به‌طور کامل پشتیبانی نمی‌کند (به دلیل پیچیدگی ساختار Binary قدیمی مایکروسافت). برای این فرمت‌ها، استخراج متن اصلی و شمارش تصاویر در اختیار شما قرار می‌گیرد.
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۷ — ثبت در Dependency Injection</h4>
<p>در فایل <code style="font-family: monospace; background: #edf2f7; padding: 2px 6px; border-radius: 4px;">Startup.cs</code>، در متد `ConfigureServices`، خط زیر را به بخش ثبت Extractor ها اضافه کنید:</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">//
// Register File Content Extractors ...
services.AddSingleton&lt;IXFileContentExtractorBase, XPdfFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XDocxFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XImageFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XAudioFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XExcelFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XVisionFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XPlainTextFileContentExtractor&gt;();
services.AddSingleton&lt;IXFileContentExtractorBase, XPowerPointFileContentExtractor&gt;(); // ← جدید</pre>
<div class="success-box">
<strong>✓ بدون نیاز به تغییرات دیگر:</strong> کلاس <code style="font-family: monospace;">XFileContentExtractor</code> (Composite Extractor) به‌طور خودکار تمام پیاده‌سازی‌های <code style="font-family: monospace;">IXFileContentExtractorBase</code> را دریافت و مدیریت می‌کند. بنابراین تنها ثبت در DI کافی است و نیازی به تغییر در منطق Composite Extractor نیست.
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۸ — تنظیمات اختیاری در appsettings.json</h4>
<p>در صورت نیاز به کنترل رفتار استخراج، می‌توانید بخش پیکربندی اختصاصی اضافه کنید (اختیاری، اما برای آینده توصیه می‌شود):</p>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">{
"AiApiConfiguration": {
"PowerPoint": {
"IncludeSpeakerNotes": true,
"IncludeTables": true,
"IncludeImageMetadata": true,
"MaxSlideCount": 0
}
}
}</pre>
<div class="info-box">
<strong>💡 نکته:</strong> این تنظیمات برای فاز فعلی اختیاری هستند و در صورت عدم وجود، مقادیر پیش‌فرض (همه `true`، بدون محدودیت اسلاید) استفاده می‌شود. در فاز بعدی می‌توان یک <code style="font-family: monospace;">XPowerPointDescriptor</code> مشابه <code style="font-family: monospace;">XPDFToImageDescriptor</code> اضافه کرد.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۶</div>
<div class="section-title">
<h3>استراتژی استخراج محتوا و قالب خروجی</h3>
<div class="subtitle">Content Extraction Strategy & Output Format</div>
</div>
</div>
<div class="section-content">
<p>خروجی متنی این Extractor به‌گونه‌ای طراحی شده است که برای موتورهای LLM قابل فهم، ساختاریافته و خوانا باشد. ترتیب استخراج محتوا در هر اسلاید به‌صورت زیر است:</p>
<table class="styled-table">
<thead>
<tr>
<th>#</th>
<th>محتوا</th>
<th>فرمت خروجی</th>
<th>پشتیبانی OpenXML</th>
<th>پشتیبانی Legacy</th>
</tr>
</thead>
<tbody>
<tr>
<td>۱</td>
<td>شماره اسلاید</td>
<td>[Slide N]</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
</tr>
<tr>
<td>۲</td>
<td>عنوان اسلاید</td>
<td>Title: ...</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--warning); font-weight: 600;">△ (تشخیص ساده)</td>
</tr>
<tr>
<td>۳</td>
<td>متن بدنه</td>
<td>Content:\n - ...</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
</tr>
<tr>
<td>۴</td>
<td>جداول</td>
<td>[Tables]\n | ... | ... |</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
</tr>
<tr>
<td>۵</td>
<td>یادداشت سخنران</td>
<td>[Speaker Notes]\n...</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
</tr>
<tr>
<td>۶</td>
<td>شمارش تصاویر</td>
<td>[Images: N]</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
</tr>
</tbody>
</table>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">نمونه خروجی برای فرمت OpenXML</h4>
<pre style="background: #1a202c; color: #e2e8f0; padding: 18px 20px; border-radius: 8px; overflow-x: auto; direction: ltr; text-align: left; font-size: 12px; line-height: 1.7; margin: 15px 0; font-family: 'Consolas', 'Monaco', monospace;">[Slide 1]
Title: مقدمه‌ای بر هوش مصنوعی
Content:
- تعریف هوش مصنوعی
- تاریخچه و تکامل
- کاربردهای امروزی
[Speaker Notes]
در این اسلاید به معرفی کوتاه هوش مصنوعی بپردازید و ...
[Images: 2]
[Slide 2]
Title: یادگیری ماشین
Content:
- supervised learning
- unsupervised learning
- reinforcement learning
[Tables]
Table 1:
| الگوریتم | کاربرد | دقت |
| Decision Tree | طبقه‌بندی | متوسط |
| Neural Network | پیش‌بینی | بالا |</pre>
<div class="highlight-box">
<strong>نکته طراحی:</strong> ساختار خروجی با استفاده از تگ‌های `[Slide N]`، `Title:`، `Content:`، `[Tables]`، `[Speaker Notes]` و `[Images: N]` طراحی شده تا LLM بتواند به‌راحتی مرزهای بین اسلایدها و نوع محتوا را تشخیص دهد. این ساختار در تمام ۹ فرمت پاورپوینت یکسان است تا تجربه پردازش یکنواخت باشد.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۷</div>
<div class="section-title">
<h3>تست و اعتبارسنجی</h3>
<div class="subtitle">Testing & Validation</div>
</div>
</div>
<div class="section-content">
<p>پس از پیاده‌سازی، تست‌های زیر برای تأیید صحت عملکرد Extractor ضروری هستند:</p>
<table class="styled-table">
<thead>
<tr>
<th>#</th>
<th>سناریو تست</th>
<th>ورودی</th>
<th>خروجی مورد انتظار</th>
</tr>
</thead>
<tbody>
<tr>
<td>۱</td>
<td>CanExtract برای همه MIME ها</td>
<td>۷ MIME Type مختلف</td>
<td>همه `true` برگردانند</td>
</tr>
<tr>
<td>۲</td>
<td>CanExtract برای MIME نامربوط</td>
<td>application/pdf</td>
<td>`false` برگرداند</td>
</tr>
<tr>
<td>۳</td>
<td>استخراج pptx ساده</td>
<td>فایل pptx با ۳ اسلاید</td>
<td>متن هر ۳ اسلاید با عنوان و محتوا</td>
</tr>
<tr>
<td>۴</td>
<td>استخراج pptx با یادداشت</td>
<td>pptx شامل Speaker Notes</td>
<td>بخش [Speaker Notes] در خروجی</td>
</tr>
<tr>
<td>۵</td>
<td>استخراج pptx با جدول</td>
<td>pptx شامل جدول ۳x۲</td>
<td>بخش [Tables] با ساختار pipe-separated</td>
</tr>
<tr>
<td>۶</td>
<td>استخراج ppsx</td>
<td>فایل SlideShow</td>
<td>مانند pptx</td>
</tr>
<tr>
<td>۷</td>
<td>استخراج potx</td>
<td>فایل Template</td>
<td>مانند pptx</td>
</tr>
<tr>
<td>۸</td>
<td>استخراج pptm</td>
<td>فایل Macro-enabled</td>
<td>مانند pptx</td>
</tr>
<tr>
<td>۹</td>
<td>استخراج ppt (Legacy)</td>
<td>فایل .ppt قدیمی</td>
<td>متن اسلایدها + شمارش تصاویر</td>
</tr>
<tr>
<td>۱۰</td>
<td>استخراج pps (Legacy)</td>
<td>فایل .pps قدیمی</td>
<td>مانند ppt</td>
</tr>
<tr>
<td>۱۱</td>
<td>فایل خالی/خراب</td>
<td>Stream نامعتبر</td>
<td>ErrorMessage تنظیم شود، استثناء پرتاب نشود</td>
</tr>
<tr>
<td>۱۲</td>
<td>Cancellation Token</td>
<td>فایل بزرگ + لغو در میانه</td>
<td>پردازش سریعاً متوقف شود</td>
</tr>
<tr class="highlight-row">
<td>۱۳</td>
<td>استقرار در Docker/Linux</td>
<td>اجرای کامل در محیط کانتینری</td>
<td>بدون خطای <code>PlatformNotSupportedException</code></td>
</tr>
</tbody>
</table>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">معیارهای موفقیت</h4>
<div class="success-box">
<strong>✓ معیار پذیرش نهایی:</strong>
<ul style="padding-right: 20px; margin-top: 10px;">
<li>تمام ۹ فرمت پاورپوینت به‌درستی پردازش شوند</li>
<li>تست‌های ۱ تا ۱۳ همگی پاس شوند</li>
<li>اجرای موفق در محیط Docker Linux بدون هیچ خطای Platform-specific</li>
<li>خروجی متنی برای موتور LLM قابل استفاده باشد</li>
<li>هیچ استثنایی به‌صورت Unhandled پرتاب نشود؛ خطاها در `ErrorMessage` ثبت گردند</li>
</ul>
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۸</div>
<div class="section-title">
<h3>جمع‌بندی نهایی</h3>
<div class="subtitle">Final Summary</div>
</div>
</div>
<div class="section-content">
<p>پیاده‌سازی `XPowerPointFileContentExtractor` با ترکیب دو کتابخانه `DocumentFormat.OpenXml` و `NPOI.HSLF`، پوشش کاملی از تمام ۹ فرمت خانواده پاورپوینت ارائه می‌دهد. این Extractor با معماری موجود کاملاً یکپارچه می‌شود و بدون نیاز به تغییر در Composite Extractor یا سایر بخش‌های سامانه، قابلیت پردازش پاورپوینت را به xAiApi اضافه می‌کند.</p>
<table class="styled-table">
<thead>
<tr>
<th>محور</th>
<th>وضعیت قبل</th>
<th>وضعیت بعد</th>
</tr>
</thead>
<tbody>
<tr>
<td>پوشش فرمت پاورپوینت</td>
<td style="color: var(--danger); font-weight: 600;">۰ فرمت</td>
<td style="color: var(--success); font-weight: 600;">۹ فرمت کامل</td>
</tr>
<tr>
<td>استخراج متن اسلایدها</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
<td style="color: var(--success); font-weight: 600;">✓</td>
</tr>
<tr>
<td>استخراج یادداشت سخنران</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
<td style="color: var(--success); font-weight: 600;">✓ (OpenXML)</td>
</tr>
<tr>
<td>استخراج جداول</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
<td style="color: var(--success); font-weight: 600;">✓ (OpenXML)</td>
</tr>
<tr>
<td>شمارش تصاویر</td>
<td style="color: var(--danger); font-weight: 600;">✗</td>
<td style="color: var(--success); font-weight: 600;">✓ (همه فرمت‌ها)</td>
</tr>
<tr>
<td>Cross-platform (Linux/Docker)</td>
<td style="color: var(--danger); font-weight: 600;">—</td>
<td style="color: var(--success); font-weight: 600;">✓ کامل</td>
</tr>
<tr class="highlight-row">
<td><strong>آمادگی تولیدی</strong></td>
<td>—</td>
<td style="color: var(--success); font-weight: 700; font-size: 15px;">بالا</td>
</tr>
</tbody>
</table>
<div class="conclusion-box">
<h3>🎯 پیشنهاد نهایی</h3>
<p>با توجه به طراحی ارائه‌شده، این Extractor آماده پیاده‌سازی است و گام‌به‌گام در این مستند شرح داده شده است. پیشنهاد می‌شود پیاده‌سازی در دو مرحله انجام شود: ابتدا OpenXML (که ۶ فرمت مدرن را پوشش می‌دهد و بخش عمده استفاده را شامل می‌شود) و سپس Legacy Binary (۳ فرمت قدیمی).</p>
<div class="highlight">
<strong>💎 ارزش پیشنهادی:</strong><br>
پوشش کامل ۹ فرمت پاورپوینت + استخراج متن، یادداشت و جداول + شمارش تصاویر + استقرار Cross-platform + یکپارچگی کامل با معماری موجود
</div>
</div>
<div class="info-box">
<strong>📞 گام بعدی:</strong> در صورت تایید این مستند، آماده‌ام پیاده‌سازی کامل را آغاز نمایم. پیشنهاد می‌شود ابتدا OpenXML (فایل‌های .pptx و خانواده) پیاده‌سازی و تست شود، سپس NPOI HSLF (فایل‌های .ppt و خانواده) اضافه گردد تا در هر مرحله امکان تست و تأیید عملکرد فراهم باشد.
</div>
</div>
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت ارائه به کارفرمای محترم تهیه شده است. هرگونه کپی‌برداری یا افشا بدون اجازه کتبی ممنوع است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">طراحی و توسعه: هادی خزاعی اصل</div>
<div class="footer-divider"></div>
<div>تاریخ تهیه: ۳۰ مهر ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۱.۰ &nbsp;|&nbsp; طبقه‌بندی: محرمانه</div>
</footer>
</div>
</body>
</html>