From 3fba9f0033618a1db9d33826c28c90d36d756db4 Mon Sep 17 00:00:00 2001 From: Jaakko Ruohio Date: Thu, 17 Aug 2023 14:05:49 +0300 Subject: [PATCH 1/2] Add content types for picture formats --- src/write.jl | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/write.jl b/src/write.jl index 4626b57..335d7d8 100644 --- a/src/write.jl +++ b/src/write.jl @@ -68,6 +68,31 @@ function update_table_style!(unzipped_ppt_dir::String=".") end end +function add_contenttypes!() + path = joinpath("..", "[Content_Types].xml") + doc = readxml(path) + r = root(doc) + extension_contenttypes = ( + ("emf", "image/x-emf"), + ("gif", "image/gif"), + ("jpeg", "image/jpeg"), + ("jpg", "application/octet-stream"), + ("png", "image/png"), + ("svg", "image/svg+xml"), + ("tif", "application/octet-stream"), + ("wmf", "image/x-wmf") + ) + for extension_contenttype in extension_contenttypes + ext, ct = extension_contenttype + # do not add the extension if it is already defined in the template + isnothing(findfirst(x -> (x.name == "Default" && x["Extension"] == ext), elements(r))) || continue + addelement!(r, "Default Extension=\"$ext\" ContentType=\"$ct\"") + end + open(path, "w") do io + prettyprint(io, doc) + end +end + """ ```julia Base.write( @@ -158,6 +183,7 @@ function Base.write( write_slides!(p) write_shapes!(p) update_table_style!() + add_contenttypes!() end zip(unzipped_dir, filename) cp(filename, filepath) From 091a068f95df7b7b8ca9151719590df90c2c5ad1 Mon Sep 17 00:00:00 2001 From: Jaakko Ruohio Date: Thu, 17 Aug 2023 14:13:32 +0300 Subject: [PATCH 2/2] Update version number --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 6763e15..966d684 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "PPTX" uuid = "14a86994-10a4-4a7d-b9ad-ef6f3b1fac6a" authors = ["Xander de Vries", "Matthijs Cox"] -version = "0.6.3" +version = "0.6.4" [deps] DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"