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`, `Styled`) and utilities
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//! - **integration** - High-level builders for presentations
26//! - **opc** - Open Packaging Convention (ZIP) handling
27//! - **oxml** - Office XML parsing and manipulation
28//! - **exc** - Error types
29
30// Core traits and utilities
31pub mod core;
32
33// Unified element types
34pub mod elements;
35
36// Main functionality
37pub mod generator;
38pub mod integration;
39pub mod cli;
40
41// Supporting modules
42pub mod config;
43pub mod constants;
44pub mod enums;
45pub mod exc;
46pub mod util;
47pub mod opc;
48pub mod oxml;
49pub mod parts;
50
51// Public API
52pub mod api;
53pub mod types;
54pub mod shared;
55
56// Easy-to-use prelude
57pub mod prelude;
58
59// Templates for common presentations
60pub mod templates;
61
62// Export functionality
63pub mod export;
64
65// Import functionality
66pub mod import;
67
68// Web2PPT module (optional feature)
69#[cfg(feature = "web2ppt")]
70pub mod web2ppt;
71
72// Re-exports for convenience
73pub use api::Presentation;
74pub use core::{ToXml, escape_xml};
75pub use elements::{Color, RgbColor, SchemeColor, Position, Size, Transform};
76pub use exc::{PptxError, Result};
77pub use generator::{
78    create_pptx, create_pptx_with_content, create_pptx_with_settings, SlideContent, SlideLayout,
79    TextFormat, FormattedText,
80    Table, TableRow, TableCell, TableBuilder,
81    Shape, ShapeType, ShapeFill, ShapeLine,
82    Image, ImageBuilder, ImageSource,
83    Chart, ChartType, ChartSeries, ChartBuilder,
84    // Bullet styles
85    BulletStyle, BulletPoint,
86    // RTL text support
87    TextDirection, RtlLanguage, RtlTextProps,
88    // Comments and annotations
89    Comment, CommentAuthor, CommentAuthorList, SlideComments,
90    // Slide sections
91    SlideSection, SectionManager,
92    // Digital signatures
93    DigitalSignature, SignerInfo, HashAlgorithm, SignatureCommitment,
94    // Ink annotations
95    InkAnnotations, InkStroke, InkPen, InkPoint, PenTip,
96    // Slide show settings
97    SlideShowSettings, ShowType, PenColor, SlideRange,
98    // Print settings and handouts
99    PrintSettings, HandoutLayout, PrintColorMode, PrintWhat, Orientation,
100    // Advanced table merging
101    TableMergeMap, MergeRegion, CellMergeState,
102    // Embedded fonts
103    EmbeddedFontList, EmbeddedFont, FontStyle, FontCharset,
104    // Presentation-level settings
105    PresentationSettings,
106    // New element types
107    Connector, ConnectorType, ConnectorLine, ArrowType, ArrowSize, ConnectionSite, LineDash,
108    Hyperlink, HyperlinkAction,
109    GradientFill, GradientType, GradientDirection, GradientStop, PresetGradients,
110    Video, Audio, VideoFormat, AudioFormat, VideoOptions, AudioOptions,
111};
112pub use integration::{PresentationBuilder, SlideBuilder, PresentationMetadata};
113pub use oxml::repair::{PptxRepair, RepairIssue, RepairResult};
114
115// Parts re-exports
116pub use parts::{
117    Part, PartType, ContentType,
118    PresentationPart, SlidePart, SlideLayoutPart, LayoutType,
119    SlideMasterPart, ThemePart, NotesSlidePart,
120    ImagePart, MediaPart, MediaFormat, ChartPart,
121    TablePart, TableRowPart, TableCellPart,
122    CorePropertiesPart, AppPropertiesPart,
123    ContentTypesPart, Relationships,
124};
125
126// Web2PPT re-exports
127#[cfg(feature = "web2ppt")]
128pub use web2ppt::{
129    Web2Ppt, WebFetcher, WebParser, WebContent, ContentBlock,
130    ContentType as WebContentType, // Renamed to avoid conflict with parts::ContentType
131    Web2PptConfig, ConversionOptions, Web2PptError,
132    html_to_pptx, html_to_pptx_with_options, url_to_pptx, url_to_pptx_with_options,
133};
134
135pub const VERSION: &str = "0.2.4";