Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add firstLineChars indent fearture #668

Open
hisphone opened this issue Dec 5, 2023 · 2 comments
Open

Add firstLineChars indent fearture #668

hisphone opened this issue Dec 5, 2023 · 2 comments

Comments

@hisphone
Copy link

hisphone commented Dec 5, 2023

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()
}
}

@jiker-burce
Copy link

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

@hisphone
Copy link
Author

Thanks for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants