Do you want to: Ask a how-to question / Suggest a feature
For feature suggestions, describe the result you would like to achieve in detail:
How can I create paragraphs using the special hanging indentation using document builder? I’ve seen in the documentation the SetIndLeft/Right and SetIndFirstLine methods for the ApiParagraph, but none of them can achieve what I’m trying to do.
Bellow you have and example of the desired result.
DocumentBuilder version: latest
Installation method: Downloaded the package from the official page and installed it using sudo dnf install <package name>
.
OS: Rocky Linux 9 in a docker container
Hello @mrmikept
I am taking closer look at this scenario. I’ll let you know if I find anything relevant, otherwise I will forward your query to the devteam to register an enhancement suggestion for this functionality.
I’d like to inform you that we’ve registered an enhancement to implement a method that would allow defining hanging ident via Office API. Thank you for your interest.
1 Like
Hello again @mrmikept
I’ve got some news on this topic. You can use SetIndFirstLine
with negative value to set a hanging ident for the first line. For example:
var oDocument = Api.GetDocument();
var oMyStyle = oDocument.CreateStyle("My document style");
var oParaPr = oMyStyle.GetParaPr();
oParaPr.SetIndFirstLine(-1440); // Negative value
Hi @Constantine
Thank you for the update.
The SetIndFirstLine
didn’t achieve alone the result I was expecting. But I tried combining it with SetIndLeft
to achieve the result I wanted.
For example:
var oParagraph = Api.CreateParagraph();
oParagraph.AddText("Term: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut tempor et massa vel hendrerit. Vestibulum tristique finibus facilisis. Vestibulum efficitur dolor vel nulla rutrum, non ullamcorper nunc finibus. Nam et leo commodo nisi dapibus consequat. Mauris aliquet mauris vitae pharetra elementum. Nullam a rhoncus nisl. Curabitur eu felis dui. Praesent interdum arcu luctus ornare ultrices. Aliquam erat volutpat. Nam quam purus, lacinia id ipsum vel, fringilla euismod tellus. Nulla vestibulum euismod lacus, ac vestibulum dolor hendrerit eleifend. Vivamus eget ultrices metus. Nulla quis leo quam. Vestibulum ut dolor neque. ");
oParagraph.SetIndLeft(720);
oParagraph.SetIndFirstLine(-720);
oDocument.Push(oParagraph);
Thank you very much!
If I have any further questions I’ll let you know!
1 Like
I am glad to know. Closing topic as solved then.