Skip to content

Commit

Permalink
Update read.jl to pass through Custom XML internal files
Browse files Browse the repository at this point in the history
Addresses issue felipenoris#210
  • Loading branch information
TimG1964 committed Jun 20, 2024
1 parent e80dba0 commit 36b0ed0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/read.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ function open_or_read_xlsx(source::Union{IO, AbstractString}, read_files::Bool,
continue
end

if endswith(f.name, ".xml") || endswith(f.name, ".rels")
# Rather than ignore custom XML internal files here, let them get passed through to write like binaries are.
if !startswith(f.name, "customXml") && (endswith(f.name, ".xml") || endswith(f.name, ".rels"))
#if endswith(f.name, ".xml") || endswith(f.name, ".rels")

# XML file
internal_xml_file_add!(xf, f.name)
if read_files
Expand All @@ -215,16 +218,18 @@ function open_or_read_xlsx(source::Union{IO, AbstractString}, read_files::Bool,
end

# ignore custom XML internal files
if startswith(f.name, "customXml")
continue
end
# no longer needed if these files are passed through like binary files
#if startswith(f.name, "customXml")
# continue
#end

internal_xml_file_read(xf, f.name)
end
elseif read_as_template

# Binary file
# we only read binary files to save the Excel file later
# Custom XML files also now get passed through this way, too
bytes = ZipFile.read(f)
@assert sizeof(bytes) == f.uncompressedsize
xf.binary_data[f.name] = bytes
Expand Down

0 comments on commit 36b0ed0

Please sign in to comment.