bokuweb / docx-rs

:memo: A .docx file writer with Rust/WebAssembly.
https://bokuweb.github.io/docx-rs/
MIT License
341 stars 59 forks source link

Not respecting the headerfooter flags properly #607

Open gjblajian opened 1 year ago

gjblajian commented 1 year ago

Describe the bug

When importing a document with a header / footer there are three possible state variables. titlePg in the sectPr indicates that the headerFooters first page property is on if it is absent it is off. When we added a First page header, enter a value then uncheck it the property on the importer is not resetting to false.

For even page header and footer the property should be based on the absence or presence of the evenAndOddHeaders element in the settings.xml. Presence being on absence being off. But the importer is always giving us false.

Reproduced step

Steps to reproduce the behavior: See above

Expected behavior

A clear and concise description of what you expected to happen. when the TitlePg element is present in the word xml sectionPr we expect the value to be true in the JSON when it is absent we expect the value to be false.

when the evenAndOddHeaders element is present in the word settings.xml we expect the value to be true in the JSON when it is absent we expect the value to be false.

Actual behavior

A clear and concise description of what you actual to happen. when the TitlePg element is present in the word xml sectionPr we get true if you unselect/uncheck it in word the value still comes across as true.

when the evenAndOddHeaders element is present in the word settings.xml the value is always false regardless of whether or not the element is in the xml

Screenshots

first page unchecked image

first page checked image

evenAndOddHeaders unchecked image

evenAndOddHeaders checked image

Desktop (please complete the following information)

N/A

gjblajian commented 1 year ago

@bokuweb could you please look at this? Thank you.

bokuweb commented 9 months ago

I'll fix it later.