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

Free Support Forum - aspose.com

ParagraphFormat.LeftIndent does not set left indent of paragraph using Java

Hello,

we have a paragraph p and try to set the leftIndent-Property on p.getParagraphFormat(). Unfortunately it doesn’t seem to work as we don’t see the desired indent it the pdf/rtf. When we set it on p.getParagraphFormat().getStyle().getParagraphFormat() it seems to work but affects other paragraphs we don’t want to indent. When we call p.getParagraphFormat().clearFormatting() prior to setting the leftIndent-Property everysting works fine but we have the feeling that we eventually lose some formats when we do so.

Here are the values of the get* and is*-Methods from p.getParagraphFormat() and p.getParagraphFormat().getStyle() before and after the call to clearFormatting(). It seems to change the basestyle but isn’t the p.getParagraphFormat() supposed to overwrite the settings of p.getParagraphFormat().getStyle().getParagraphFormat() anyways?

Before clearFormatting()
===============================
-------------------------------
ParagraphFormat
-------------------------------

isListItem: false
getStyle: <com.aspose.words.Style@118072d>
getBorders: <com.aspose.words.BorderCollection@7f3fd1>
getAlignment: 0
getStyleName: Normal\_58\_2
getBidi: false
getStyleIdentifier: 4094
getOutlineLevel: 9
getSpaceBeforeAuto: false
getTabStops: <com.aspose.words.TabStopCollection@36f12b>
getShading: <com.aspose.words.Shading@1135ae2>
isHeading: false
getDirectBorderAttr: Fehler
getLeftIndent: 0.0
getRightIndent: 0.0
getSpaceAfter: 0.0
getSpaceBefore: 0.0
getDropCapPosition: 0
getFirstLineIndent: 0.0
getKeepTogether: false
getKeepWithNext: false
getLineSpacing: 12.0
getLineSpacingRule: 2
getLinesToDrop: 0
getNoSpaceBetweenParagraphsOfSameStyle: false
getPageBreakBefore: false
getSpaceAfterAuto: false
getSuppressAutoHyphens: false
getSuppressLineNumbers: false
getWidowControl: true
getClass: class com.aspose.words.ParagraphFormat

-------------------------------
Style
-------------------------------

getName: Normal\_58\_2
getType: 1
getStyles: <com.aspose.words.StyleCollection@1822edd>
getDocument: <com.aspose.words.Document@1d2d3d8>
getList: null
getFont: <com.aspose.words.Font@52247c>
getParagraphFormat: <com.aspose.words.ParagraphFormat@d9752a>
getListFormat: <com.aspose.words.ListFormat@9b2e60>
getDirectRunAttr: Fehler
getDirectRunAttrByIndex: Fehler
getDirectRunAttrsCount: 5
getBaseStyleName: 
getBuiltIn: false
getStyleIdentifier: 4094
getDirectParaAttr: Fehler
getDirectParaAttrByIndex: Fehler
getDirectParaAttrsCount: 7
getNextParagraphStyleName: Normal\_58\_2
isHeading: false

After clearFormatting()
===============================
-------------------------------
ParagraphFormat
-------------------------------

isListItem: false
getStyle: <com.aspose.words.Style@cc4f58>
getBorders: <com.aspose.words.BorderCollection@7f3fd1>
getAlignment: 0
getStyleName: Normal
getBidi: false
getStyleIdentifier: 0
getOutlineLevel: 9
getSpaceBeforeAuto: false
getTabStops: <com.aspose.words.TabStopCollection@16d4e1b>
getShading: <com.aspose.words.Shading@122dfc2>
isHeading: false
getDirectBorderAttr: Fehler
getLeftIndent: 0.0
getRightIndent: 0.0
getSpaceAfter: 0.0
getSpaceBefore: 0.0
getDropCapPosition: 0
getFirstLineIndent: 0.0
getKeepTogether: false
getKeepWithNext: false
getLineSpacing: 12.0
getLineSpacingRule: 2
getLinesToDrop: 0
getNoSpaceBetweenParagraphsOfSameStyle: false
getPageBreakBefore: false
getSpaceAfterAuto: false
getSuppressAutoHyphens: false
getSuppressLineNumbers: false
getWidowControl: true
getClass: class com.aspose.words.ParagraphFormat

-------------------------------
Style
-------------------------------

getClass: class com.aspose.words.Style
getName: Normal
getType: 1
getStyles: <com.aspose.words.StyleCollection@1822edd>
getDocument: <com.aspose.words.Document@1d2d3d8>
getList: null
getFont: <com.aspose.words.Font@1b67a>
getParagraphFormat: <com.aspose.words.ParagraphFormat@731d3c>
getListFormat: <com.aspose.words.ListFormat@184558d>
getDirectRunAttr: Fehler
getDirectRunAttrByIndex: Fehler
getDirectRunAttrsCount: 5
getBaseStyleName: 
getBuiltIn: true
getStyleIdentifier: 0
getDirectParaAttr: Fehler
getDirectParaAttrByIndex: Fehler
getDirectParaAttrsCount: 7
getNextParagraphStyleName: Normal
isHeading: false
getClass: class com.aspose.words.Style

With kind regards
Klemens Schrage

Hi Klemens,

Thanks for your query. It would be great, If you share your code and document file for investigation purposes.

Hello,

fortunately we were able to solve the problem by using Version 10.6.0 instead of 10.1.0.

Best regards
Klemens Schrage

Hi Klemens,

Thanks for your details. It is great to hear that your issue has been resolved. You are always welcome and please feel free to ask if you have any query in future.

We always welcome constructive response from our customers.