We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Calculate indent to paragraph?


Can I use aspose.words to calculate the exact indent to text in a paragraph? So if I have

1->Hello there
1.1->This is some text
This is some embedded text
And this is some text in 1

(where -> is the tab after a numbered item)
I want to calculate the indent to the start of the text in each case. For normal paragraphs it is simply leftIndent, but for numbered items it is a bit more complex due to the presence of tabs.

I figure you guys must be doing it to be able to make jpg’s etc, is that calculation exposed in any way that I can use to help interpret a document?


Hi Simon,

Thanks for your inquiry. You can use ParagraphFormat.LeftIndent property to get the value (in points) that represents the left indent for paragraph. Please check NumberPosition and TabPosition properties of ListLevel class. Hope this helps you.

Hi Tahir,

That’s just what I want. Now I want to add the indentation of this paragraph as a property of the paragraph (because it’s parsed by something else). So I want to add a custom attribute to the paragraph to let the next parser know the exact indentation - is there a way to do this?

Hi Simon,

Thanks for your inquiry. In your case, you need to use the ParagraphFormat.LeftIndent, ListLevel.NumberPosition and ListLevel.TabPosition properties to get the required value and pass it to your parser. If you face any issue, please share your input document along with expected values of indentation. We will provide you more information about your query along with code.