diff --git a/Cargo.lock b/Cargo.lock index 5dd57d4c5..6f525f7c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -919,6 +919,11 @@ dependencies = [ "libc", ] +[[package]] +name = "craft-cfb" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e#3b8e426a260695af840a2cd79a064d40778f939e" + [[package]] name = "craft-cfb" version = "0.1.0" @@ -932,6 +937,17 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-drawingml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e#3b8e426a260695af840a2cd79a064d40778f939e" +dependencies = [ + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e)", + "kurbo", + "log", + "serde", +] + [[package]] name = "craft-drawingml" version = "0.1.0" @@ -1026,7 +1042,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d dependencies = [ "aes", "base64 0.23.1", - "craft-cfb", + "craft-cfb 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", "getrandom 0.3.4", "hmac", @@ -1071,6 +1087,11 @@ name = "craft-sheet" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=010702ee9b030844c852939095b1da0d0656a890#010702ee9b030844c852939095b1da0d0656a890" +[[package]] +name = "craft-sheet" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e#3b8e426a260695af840a2cd79a064d40778f939e" + [[package]] name = "craft-sheet" version = "0.1.0" @@ -1176,10 +1197,10 @@ dependencies = [ [[package]] name = "craft-xls" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280#e98299546f5c5c3c22388d16507f8b5e61a5f280" +source = "git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e#3b8e426a260695af840a2cd79a064d40778f939e" dependencies = [ - "craft-cfb", - "craft-sheet 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", + "craft-cfb 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e)", + "craft-sheet 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e)", "md-5", "miniz_oxide 0.9.1", "sha1 0.10.7", @@ -1191,7 +1212,7 @@ name = "craft-xlsx" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280#e98299546f5c5c3c22388d16507f8b5e61a5f280" dependencies = [ - "craft-drawingml", + "craft-drawingml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", "craft-opc", "craft-sheet 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", @@ -1208,6 +1229,16 @@ dependencies = [ "thiserror 2.0.21", ] +[[package]] +name = "craft-xml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e#3b8e426a260695af840a2cd79a064d40778f939e" +dependencies = [ + "quick-xml 0.41.0", + "serde", + "thiserror 2.0.21", +] + [[package]] name = "craft-xml" version = "0.1.0" @@ -2466,8 +2497,9 @@ dependencies = [ name = "gridcraft-xlsx" version = "0.19.1" dependencies = [ - "craft-cfb", + "craft-cfb 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280)", "craft-csv", + "craft-drawingml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=3b8e426a260695af840a2cd79a064d40778f939e)", "craft-math", "craft-ods", "craft-offcrypto", diff --git a/Cargo.toml b/Cargo.toml index 620f7a961..e6e272707 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,8 @@ craft-gridcraft-format = { git = "https://github.com/storytold/craft-libs", rev # SpreadsheetML string encoding/decoding; workbook model mapping stays in gridcraft-xlsx. craft-xlsx = { git = "https://github.com/storytold/craft-libs", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", version = "0.1.0" } craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", version = "0.1.0" } -craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", version = "0.1.0" } +craft-xls = { git = "https://github.com/storytold/craft-libs", rev = "3b8e426a260695af840a2cd79a064d40778f939e", version = "0.1.0" } +craft-drawingml = { git = "https://github.com/storytold/craft-libs", rev = "3b8e426a260695af840a2cd79a064d40778f939e", version = "0.1.0" } # foundation thiserror = "2" diff --git a/crates/xlsx/Cargo.toml b/crates/xlsx/Cargo.toml index 05677ad89..8e2f42cb6 100644 --- a/crates/xlsx/Cargo.toml +++ b/crates/xlsx/Cargo.toml @@ -20,6 +20,7 @@ gridcraft-math = { workspace = true } gridcraft-model = { workspace = true } craft-cfb = { workspace = true } craft-csv = { workspace = true } +craft-drawingml = { workspace = true } craft-math = { workspace = true } craft-ods = { workspace = true } craft-offcrypto = { workspace = true } diff --git a/crates/xlsx/src/chartex.rs b/crates/xlsx/src/chartex.rs index de54c5942..d90ed3505 100644 --- a/crates/xlsx/src/chartex.rs +++ b/crates/xlsx/src/chartex.rs @@ -20,7 +20,16 @@ pub const REL_COLORS: &str = "http://schemas.microsoft.com/office/2011/relations /// Kinds written as chartex parts. pub fn is_chartex(k: ChartKind) -> bool { - matches!(k, ChartKind::Histogram | ChartKind::BoxWhisker | ChartKind::Waterfall | ChartKind::Funnel | ChartKind::Treemap | ChartKind::Sunburst) + use craft_drawingml::chart::ChartType; + match k { + ChartKind::Histogram => ChartType::Histogram.is_chartex(), + ChartKind::BoxWhisker => ChartType::BoxWhisker.is_chartex(), + ChartKind::Waterfall => ChartType::Waterfall.is_chartex(), + ChartKind::Funnel => ChartType::Funnel.is_chartex(), + ChartKind::Treemap => ChartType::Treemap.is_chartex(), + ChartKind::Sunburst => ChartType::Sunburst.is_chartex(), + _ => false, + } } /// The `mc:Choice` requirement for a kind's drawing frame: (prefix, namespace). Funnel charts diff --git a/crates/xlsx/src/drawing.rs b/crates/xlsx/src/drawing.rs index 6b4d538bc..2f9d2e709 100644 --- a/crates/xlsx/src/drawing.rs +++ b/crates/xlsx/src/drawing.rs @@ -227,7 +227,7 @@ fn read_shape(obj: &El, anchor: Anchor) -> Option { // shape (an ellipse, a filled rectangle) it, like any other warp, leaves the shape what its // geometry says. let word_art = prst == "rect" - && (tx_box || (sp.child("noFill").is_some() && !ln.is_some_and(|l| l.child("solidFill").is_some()))) + && (tx_box || (sp.child("noFill").is_some() && ln.is_none_or(|l| l.child("solidFill").is_none()))) && obj.path(&["txBody", "bodyPr", "prstTxWarp"]).is_some_and(|w| w.attr("prst") == Some("textNoShape")); let kind = match prst { _ if word_art => ShapeKind::WordArt,