docxcraft 0.1.0

Generate editable DOCX documents with rich text, tables, charts and SVG drawings
Documentation
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2026 ALGFORCE INC.

use docxcraft::{chart::Chart, document::Document, paragraph::Paragraph};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let locale = String::from("en");
    let mut document = Document::new(&locale);
    document.add_paragraph(Paragraph::new("Quarterly sales".into()));
    let option = r#"{
        "xAxis": { "type": "category", "data": ["Q1", "Q2"] },
        "yAxis": { "type": "value" },
        "series": [{ "name": "Revenue", "type": "bar", "data": [120, 180] }]
    }"#;
    document.add_chart(Chart::from_echart_option("Revenue", option, None)?);

    std::fs::create_dir_all("target/examples")?;
    document.save("target/examples/chart.docx")?;
    Ok(())
}