docx-rs icon indicating copy to clipboard operation
docx-rs copied to clipboard

Allow setting number of columns for paragraph

Open nikitavbv opened this issue 1 year ago • 3 comments

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 avatar Nov 26 '23 12:11 nikitavbv

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.

nikitavbv avatar Nov 26 '23 15:11 nikitavbv

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

bokuweb avatar Dec 01 '23 10:12 bokuweb

@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

nikitavbv avatar Dec 02 '23 17:12 nikitavbv