bokuweb / docx-rs

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

Allow setting number of columns for paragraph #664

Open nikitavbv opened 9 months ago

nikitavbv commented 9 months ago

First of all, thank you for maintaining this crate! It is really useful!

Is your feature request related to a problem? Please describe.

I am trying to create a document that contains both paragraphs with one and two columns. See the screenshot below for an example.

Screenshot 2023-11-26 at 1 54 38 PM

In my understanding, that can be achieved by setting section property for paragraph property. The problem is that while docx-rs supports setting section property, it is not included in the resulting XML.

Describe the solution you'd like

Include section property in the resulting XML of paragraph property.

Describe alternatives you've considered

It does not seem that there are any alternative solutions here. If I missed something, please let me know!

Additional context

Please let me know what you think about possible solutions, and I will be happy to submit an MR for this!

Thank you!

nikitavbv commented 9 months ago

There is also Section, but it seems there is no way available to add it to the document and to access the property to update SectionProperty values.

bokuweb commented 8 months ago

@nikitavbv Thanks. I'll consider about it. If it is possible, cloud you please provide sample docx?

nikitavbv commented 8 months ago

@bokuweb Sure! Please see the attached file (I created it using Word). example.docx

If you check how the resulting XML looks like, you may notice that Word adds empty paragraphs with a section property that indicates how many columns are used in the preceding text: document structure