Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
7eadc0b
feat(charts): Add chart support to slide layouts and generator
awol2005ex Dec 29, 2025
e272ebe
feat(charts): Add Excel data support and enhance chart functionality
awol2005ex Dec 29, 2025
d5919db
feat(charts): Add Excel data support and enhance chart functionality
awol2005ex Dec 29, 2025
3fa543f
feat(charts): Add chart relationship file generation and refactor Exc…
awol2005ex Dec 29, 2025
3abf6b6
feat(charts): Add chart relationship file generation and refactor Exc…
awol2005ex Dec 29, 2025
08b818a
feat(charts): Add XML generation support for chart styles and colors
awol2005ex Dec 29, 2025
5699f2a
feat(chart generation): Improve chart XML generation and file naming …
awol2005ex Dec 30, 2025
659b4c2
feat(generator): Add support for WPS-compatible slide layouts and charts
awol2005ex Dec 30, 2025
4bff166
feat(i18n): Add system language detection and support for multilingua…
awol2005ex Dec 30, 2025
d7492a8
fix(charts): Resolve axis ID conflicts in chart XML generation
awol2005ex Dec 30, 2025
ba96a8a
fix(charts): Correct chart axis definition structure and standardize …
awol2005ex Dec 30, 2025
35ac1e4
fix(charts): Fix axis ID references and cross-references for scatter …
awol2005ex Dec 31, 2025
55ac70d
docs(charts): Replace Chinese comments with English comments in chart…
awol2005ex Dec 31, 2025
e4f338c
feat(theme_xml): Replace Chinese text in slide layouts with English
awol2005ex Dec 31, 2025
59f70bd
refactor(generator): Remove debug println statements
awol2005ex Dec 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 74 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ anyrepair = "0.1"
clap = { version = "4.5", features = ["derive"] }
pulldown-cmark = "0.10"
syntect = "5.2"
rust_xlsxwriter = "0.92.2"
# Windows API for language detection (Windows only)
windows-sys = { version = "0.52", features = ["Win32_System_SystemInformation"], optional = true }
# Web2PPT dependencies
reqwest = { version = "0.11", features = ["blocking"], optional = true }
scraper = { version = "0.18", optional = true }
Expand All @@ -33,6 +36,7 @@ url = { version = "2.5", optional = true }
[features]
default = ["web2ppt"]
web2ppt = ["reqwest", "scraper", "url"]
windows-lang = ["windows-sys"]

[dev-dependencies]
insta = "1.34"
Expand Down
92 changes: 92 additions & 0 deletions examples/actual_charts_demo.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
//! Actual chart demonstration with real charts in slides

use ppt_rs::generator::{
create_pptx_with_content, SlideContent, SlideLayout,
ChartType, ChartSeries, ChartBuilder,
};

fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("=== Creating Presentation with Real Charts ===\n");

// Slide 1: Title
let title_slide = SlideContent::new("Real Charts Demo")
.add_bullet("This presentation contains actual charts")
.add_bullet("Not just text descriptions")
.layout(SlideLayout::TitleAndContent);

// Slide 2: Bar Chart - Actual data
let bar_chart = ChartBuilder::new("Quarterly Sales", ChartType::Bar)
.categories(vec!["Q1", "Q2", "Q3", "Q4"])
.add_series(ChartSeries::new("2023", vec![100.0, 120.0, 140.0, 160.0]))
.add_series(ChartSeries::new("2024", vec![110.0, 135.0, 155.0, 180.0]))
.position(2675890, 1725930) // Position on slide (WPS reference)
.size(6839585, 3959860) // Size (WPS reference)
.build();

let bar_slide = SlideContent::new("Bar Chart: Sales Comparison")
.add_chart(bar_chart)
.add_bullet("2024 shows consistent growth over 2023")
.add_bullet("Q4 is the strongest quarter");

// Slide 3: Line Chart - Trend analysis
let line_chart = ChartBuilder::new("Monthly Revenue Trend", ChartType::Line)
.categories(vec!["Jan", "Feb", "Mar", "Apr", "May", "Jun"])
.add_series(ChartSeries::new("Revenue (K$)", vec![50.0, 55.0, 62.0, 58.0, 68.0, 75.0]))
.position(2675890, 1725930)
.size(6839585, 3959860)
.build();

let line_slide = SlideContent::new("Line Chart: Revenue Trend")
.add_chart(line_chart)
.add_bullet("Steady upward trend from January to June")
.add_bullet("Peak in June: $75K");

// Slide 4: Pie Chart - Market share
let pie_chart = ChartBuilder::new("Market Share Distribution", ChartType::Pie)
.categories(vec!["Product A", "Product B", "Product C", "Others"])
.add_series(ChartSeries::new("Share %", vec![35.0, 28.0, 22.0, 15.0]))
.position(2675890, 1725930)
.size(6839585, 3959860) // Use standard WPS reference coordinates
.build();

let pie_slide = SlideContent::new("Pie Chart: Market Share")
.add_chart(pie_chart)
.add_bullet("Product A leads with 35% market share")
.add_bullet("Top 3 products account for 85% of market");

// Slide 5: Scatter Chart - Correlation analysis
let scatter_chart = ChartBuilder::new("Price vs Sales Correlation", ChartType::Scatter)
.categories(vec!["10", "20", "30", "40", "50", "60"]) // Price points
.add_series(ChartSeries::new("Product Sales", vec![150.0, 120.0, 90.0, 75.0, 60.0, 45.0])) // Sales volume
.position(2675890, 1725930)
.size(6839585, 3959860)
.build();

let scatter_slide = SlideContent::new("Scatter Chart: Price vs Sales")
.add_chart(scatter_chart)
.add_bullet("Higher price correlates with lower sales volume")
.add_bullet("Optimal price point appears to be around $10-20");

let slides = vec![
title_slide,
bar_slide,
line_slide,
pie_slide,
scatter_slide,
];

// Generate the PPTX file
let pptx_data = create_pptx_with_content("Real Charts Demo", slides.clone())?;
std::fs::write("real_charts_demo.pptx", pptx_data)?;

println!("βœ“ Created real_charts_demo.pptx with:");
println!(" - Title slide");
println!(" - Bar chart: Quarterly sales comparison");
println!(" - Line chart: Monthly revenue trend");
println!(" - Pie chart: Market share distribution");
println!(" - Scatter chart: Price vs Sales correlation");
println!("\nTotal slides: {}", slides.len());
println!("\nNote: Check if charts are visible in the generated PPTX file");

Ok(())
}
Loading