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

Add firstLineChars indent fearture

Open hisphone opened this issue 1 year ago • 2 comments

I want to set firstLineChars indent. But I found that I can set it, it's not writen to the xml. Can you add this feature to the crate.

impl BuildXML for Indent { fn build(&self) -> Vec { XMLBuilder::new() .indent( self.start, self.special_indent, self.end.unwrap_or_default(), self.start_chars, ) .build() } }

hisphone avatar Dec 05 '23 00:12 hisphone

Yes, you can use the special_indent parameter to set the first line indentation. The following snippet demonstrates how to set it up, and it has been verified to produce correct DOCX output:

Paragraph::new().add_run(Run::new().add_text(DUMMY)).indent(
            Some(840), // the left margin of the paragraph 
            Some(SpecialIndentType::FirstLine(720)), // Used to set the first line indentation, hanging indentation
            None,
            None,
        )

Environment: MacOs Version: Sonoma 14.3.1 docx-rs version: 0.4.8

jiker-burce avatar Mar 18 '24 06:03 jiker-burce

Thanks for your help

hisphone avatar Jun 14 '24 02:06 hisphone