Skip to main content

ppt_rs/
lib.rs

1//! PowerPoint (.pptx) file manipulation library
2//!
3//! A comprehensive Rust library for creating, reading, and updating PowerPoint 2007+ (.pptx) files.
4//!
5//! # Quick Start
6//!
7//! ```rust,no_run
8//! use ppt_rs::{create_pptx_with_content, SlideContent};
9//!
10//! let slides = vec![
11//!     SlideContent::new("Welcome")
12//!         .add_bullet("First point")
13//!         .add_bullet("Second point"),
14//! ];
15//! let pptx_data = create_pptx_with_content("My Presentation", slides).unwrap();
16//! std::fs::write("output.pptx", pptx_data).unwrap();
17//! ```
18//!
19//! # Module Organization
20//!
21//! - **core** - Core traits (`ToXml`, `Positioned`) and utilities (XML utils, dimensions, validation, package validation)
22//! - **elements** - Unified element types (Color, Position, Size, Transform)
23//! - **generator** - PPTX file generation with ZIP packaging and XML creation
24//! - **parts** - Package parts (SlidePart, ImagePart, ChartPart)
25//! - **api** - High-level `Presentation` builder (create, save, import, export)
26//! - **prelude** - Simplified API: macros, unit helpers, shapes, colors, themes
27//! - **helpers** - Color / table / shape / extension helpers
28//! - **templates** - Pre-built presentation templates
29//! - **export** - Export to Markdown, HTML, images
30//! - **import** - PPTX import, HTML-to-PPTX
31//! - **opc** - Open Packaging Convention (ZIP) handling
32//! - **oxml** - Office XML parsing and manipulation
33//! - **exc** - Error types
34
35pub mod core;
36pub mod elements;
37pub mod generator;
38#[cfg(feature = "cli")]
39pub mod cli;
40pub mod exc;
41pub mod opc;
42pub mod oxml;
43pub mod parts;
44pub mod api;
45pub mod prelude;
46pub mod helpers;
47pub mod templates;
48pub mod export;
49pub mod import;
50
51#[cfg(feature = "mcp")]
52pub mod mcp;
53
54#[cfg(feature = "web2ppt")]
55pub mod web2ppt;
56
57pub use api::Presentation;
58pub use core::{ToXml, escape_xml};
59pub use elements::{Color, RgbColor, SchemeColor, Position, Size, Transform};
60pub use exc::{messages, PptxError, Result};
61pub use generator::{
62    create_pptx, create_pptx_with_content, create_pptx_with_settings, create_pptx_with_template,
63    create_pptx_to_writer, create_pptx_with_content_to_writer, create_pptx_lazy_to_writer,
64    LazySlideSource, PptxTemplate, STANDARD_LAYOUT_COUNT,
65    SlideContent, SlideLayout,
66    TextFormat, FormattedText,
67    Table, TableRow, TableCell, TableBuilder,
68    Shape, ShapeType, ShapeFill, ShapeLine,
69    Image, ImageBuilder, ImageSource,
70    Chart, ChartType, ChartSeries, ChartBuilder,
71    BulletStyle, BulletPoint,
72    TextDirection, RtlLanguage, RtlTextProps,
73    Comment, CommentAuthor, CommentAuthorList, SlideComments,
74    SlideSection, SectionManager,
75    DigitalSignature, SignerInfo, HashAlgorithm, SignatureCommitment,
76    InkAnnotations, InkStroke, InkPen, InkPoint, PenTip,
77    SlideShowSettings, ShowType, PenColor, SlideRange,
78    PrintSettings, HandoutLayout, PrintColorMode, PrintWhat, Orientation,
79    TableMergeMap, MergeRegion, CellMergeState,
80    EmbeddedFontList, EmbeddedFont, FontStyle, FontCharset,
81    PresentationSettings,
82    PresentationTheme, ThemeColorScheme, ThemeFonts,
83    Connector, ConnectorType, ConnectorLine, ArrowType, ArrowSize, ConnectionSite, LineDash,
84    Hyperlink, HyperlinkAction,
85    GradientFill, GradientType, GradientDirection, GradientStop, PresetGradients,
86    Video, Audio, VideoFormat, AudioFormat, VideoOptions, AudioOptions,
87};
88pub use core::{
89    validate_package, validate_package_bytes, validate_powerpoint_structure,
90    CompatReport, PackageValidationIssue, PackageValidationReport,
91    REQUIRED_PACKAGE_PARTS, ValidationCategory, ValidationSeverity,
92};
93
94// Export convenience types for new capabilities
95pub use import::html::{parse_html, parse_html_with_options, HtmlParseOptions, Html2Ppt};
96pub use export::md::{MarkdownOptions, export_to_markdown, export_to_markdown_with_options};
97pub use export::image_export::{
98    ImageExportOptions, ImageFormat,
99    export_to_images, export_slide_to_image, render_thumbnail
100};
101pub use export::slide_render::{render_to_pdf, render_to_pdf_bytes};
102
103#[cfg(feature = "pdf-native")]
104pub use export::pdf_export::{
105    export_to_pdf, export_to_pdf_bytes,
106    PdfExportOptions, PdfOrientation,
107};
108pub use opc::compress::{
109    CompressionOptions, CompressionLevel, CompressionResult,
110    compress_pptx, compress_pptx_in_memory, analyze_pptx
111};
112
113pub use parts::{
114    Part, PartType, ContentType,
115    PresentationPart, SlidePart, SlideLayoutPart, LayoutType,
116    SlideMasterPart, ThemePart, NotesSlidePart,
117    ImagePart, MediaPart, MediaFormat, ChartPart,
118    TablePart, TableRowPart, TableCellPart,
119    CorePropertiesPart, AppPropertiesPart,
120    ContentTypesPart, Relationships,
121};
122
123#[cfg(feature = "web2ppt")]
124pub use web2ppt::{
125    Web2Ppt, WebFetcher, WebParser, WebContent, ContentBlock,
126    ContentType as WebContentType,
127    Web2PptConfig, ConversionOptions, Web2PptError,
128    html_to_pptx, html_to_pptx_with_options, url_to_pptx, url_to_pptx_with_options,
129};
130
131pub const VERSION: &str = "0.2.19";