|
//Set the before spacing value as 0 for that particular paragraph. paragraph.ParagraphFormat.BeforeSpacing = 0; |
Thanks It solved the problem. But I need space before the paragraph. How can I give space before this paragraph and my list item text is not on the same level (indentation and hanging indent).ListItem first line and subsequent line is not on the same level indentation.How can I do this . My code is for list is
//Adds new list style to the document
ListStyle listStyle =document.AddListStyle(ListType.Numbered, "UserDefinedList"); //"UserDefinedList"
WListLevel levelOne = listStyle.Levels[0];
//Defines the follow character, prefix, suffix, start index for level 0
levelOne.FollowCharacter = FollowCharacterType.Nothing;
levelOne.NumberSufix = ".";
levelOne.PatternType = ListPatternType.Arabic;
levelOne.StartAt = 1;
levelOne.ParagraphFormat.FirstLineIndent = -18;
levelOne.TextPosition = 18;
levelOne.NumberAlignment = ListNumberAlignment.Left;
WListLevel levelTwo = listStyle.Levels[1];
//Defines the follow character, suffix, pattern, start index for level 1
levelTwo.FollowCharacter = FollowCharacterType.Tab;
levelTwo.NumberSufix = ".";
levelTwo.PatternType = ListPatternType.UpLetter;
//levelTwo.ParagraphFormat.LeftIndent = 12;
levelTwo.ParagraphFormat.FirstLineIndent = -18;
levelTwo.TextPosition = 70;
levelTwo.StartAt = 1;
|
Scenario |
Solution |
|
Lines preserve in same level and including list number |
Kindly set FirstLineIndent as zero. Please refer below code snippet. levelOne.ParagraphFormat.FirstLineIndent = 0; |
|
Lines preserve in same level and excluding list number
|
To meet this requirement, you need to set the custom hanging indent values. So, kindly use the below code to preserve the first and subsequent lines in the same level. levelOne.ParagraphFormat.FirstLineIndent = -13.5f; |