Quantcast
Channel: html2openxml Discussions Rss Feed
Viewing all articles
Browse latest Browse all 228

New Post: List Paragraph Styles and Indentation

$
0
0
There have been several different threads on list paragraph styles, bullets, and indenting. One thing I have noticed among them is that the "List Paragraph" style itself seems to behave differently for different developers here.

Consider the current way nested lists are handled:
// Save the new paragraph reference to support nested numbering list.
Paragraph p = currentParagraph;
currentParagraph.InsertInProperties(prop => {
     prop.ParagraphStyleId = new ParagraphStyleId() { Val = htmlStyles.GetStyle("ListParagraph", StyleValues.Paragraph) };
     prop.SpacingBetweenLines = new SpacingBetweenLines() { After = "0" };
     prop.Indentation = new Indentation() { Hanging = "357", Left = (level  * 357).ToString(CultureInfo.InvariantCulture) };
     prop.NumberingProperties = new NumberingProperties
     {
          NumberingLevelReference = new NumberingLevelReference() { Val = level - 1 },
          NumberingId = new NumberingId() { Val = numberingId }
     };
});
For some, it appears the indentation works fine, but when I updated to the latest code for my project, I lost the indentation completely. The solution for me was to change the prop.Indentation to:
prop.Indentation = new Indentation() { Hanging = "357", Left = ((level + 1)  * 357).ToString(CultureInfo.InvariantCulture) };
I wonder if there's something obscure in the way my List Paragraph style is defined that forces me to change the level references. In an earlier version, I had to fix the indentation by removing this line entirely. I can't see anything weird about my list style, all it does is drop the font size slightly and indent by 0.5, but certainly I get different end results than others.

I just want to put this out there in case others are having similar issues with this. It seems that other, possibly local, conditions are in play and if the solutions in the other threads aren't working quite right for you adjusting the levels might help out.

Viewing all articles
Browse latest Browse all 228

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>