docx icon indicating copy to clipboard operation
docx copied to clipboard

fix: Ensure necessary namespaces are in patched doc

Open joshkel opened this issue 1 year ago • 1 comments

Word for the web, for example, may generate .docx files with a very limited set of XML namespaces:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">

Using one of these files as the template / source for a docx.js patch may result in errors from missing namespaces.

To fix this, I added the handful of namespaces that appear to be needed by docx.js's elements. It may be better to include the full set of namespaces from the Document class. If you'd prefer I do that, please let me know.

I did some refactoring to simplify this and to cut down on duplicate namespace references. If you'd prefer I handle this differently, please let me know.

Fixes #2697

joshkel avatar Jul 03 '24 01:07 joshkel

Seems good, need to make the CI to start. Unsure why it isn't starting

dolanmiu avatar Aug 16 '24 03:08 dolanmiu

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (e80a50d) to head (6109e42). Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #2698   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          286       286           
  Lines         8370      8363    -7     
  Branches      1400      1409    +9     
=========================================
- Hits          8370      8363    -7     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 06 '25 22:01 codecov[bot]