Bullets and numbering extra indentation

Home Forums Open-Xml-PowerTools Bullets and numbering extra indentation

This topic contains 2 replies, has 2 voices, and was last updated by  gamartin 7 years, 2 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #4133

    gamartin
    Participant

    Eric:

    It seems that when using the htmlToWmlConverter, the numbering elements created all have what appears to be an “extra” node <w:tabs><w:tab w:val="num" w:pos="xxxx"/></w:tabs> where the xxxx is a number that matches the w:left value in the same <w:pPr> node.

    Having this “extra” information causes any multi-line list item to have extra hanging indentation – roughly 0.10 of an inch.

    The OpenXml documentation at https://msdn.microsoft.com/en-us/library/office/ee922775(v=office.14).aspx does not have this extra node, and removing it resolves my issue.

    Is this a bug or am I missing something? I am looking at a simple page right now that only has single level bullet lists, but have more complex content that includes various numbering schemes with multiple levels and don’t want to break anything!

    Thanks.

    #4134

    Eric White
    Keymaster

    I don’t have quite enough information to help with this. Can you post the markup for the entire paragraph, and where you think it wrong? Feel free to post a doc online somewhere if you want me to examine the markup.

    There is an issue I see with your description – tabs are not ‘additive’ – they are directly positioned.

    There is another issue which is that Word has a fairly complex algorithm for text positioning, including that if a word extends past a tab position, then Word automatically ‘creates’ a tab based on specific settings in the Open XML document. There can be issues associated with transforming Open XML (rendered by Word) to HTML (rendered by browsers) where font metrics are ever so slightly different, and something that fits within one tab as rendered in Word extends beyond the tab, rendered in the browser, causing text to ‘shift over’.

    The WmlToHtmlConverter project was never intended to do a pixel by pixel rendering of the document. It isn’t possible without writing a layout engine that is compatible feature-for-feature with Word, and this would include using a Word compatible text renderer (which browsers are not). There is enough mismatch between the layout system of Word and the layout system of HTML that you just have to do the best you can, and then don’t worry too much about it.

    The intent of WmlToHtmlConverter is to give a pretty good representation of the document, but it can’t be perfect.

    With regards to your specific case, it is important to understand exactly what is going on, and it is possible that the “extra” node is adjusting the ‘tabbing’ system (which calculates spans with a given width) in an unexpected way.

    Best, Eric

    #4135

    gamartin
    Participant

    Eric:

    Here is an example of what is being generated by the HtmlToWmlConverter:

    <w:abstractNum w:abstractNumId="1">
        <w:nsid w:val="E4F23709"/>
        <w:multiLevelType w:val="multilevel"/>
        <w:tmpl w:val="02BEA0DA"/>
        <w:lvl w:ilvl="0">
          <w:start w:val="1"/>
          <w:numFmt w:val="bullet"/>
          <w:lvlText w:val=""/>
          <w:lvlJc w:val="left"/>
          <w:pPr>
            <w:tabs>
              <w:tab w:val="num" w:pos="720"/>
            </w:tabs>
            <w:ind w:left="720" w:hanging="360"/>
          </w:pPr>
          <w:rPr>
            <w:rFonts w:ascii="Symbol" w:hAnsi="Symbol" w:hint="default"/>
            <w:sz w:val="20"/>
          </w:rPr>
        </w:lvl>
        <w:lvl w:ilvl="1">
          <w:start w:val="1"/>
          <w:numFmt w:val="bullet"/>
          <w:lvlText w:val="o"/>
          <w:lvlJc w:val="left"/>
          <w:pPr>
            <w:tabs>
              <w:tab w:val="num" w:pos="1440"/>
            </w:tabs>
            <w:ind w:left="1440" w:hanging="360"/>
          </w:pPr>
          <w:rPr>
            <w:rFonts w:ascii="Courier New" w:hAnsi="Courier New" w:hint="default"/>
            <w:sz w:val="20"/>
          </w:rPr>
        </w:lvl>

    If I remove all the <w:tabs....> nodes, the alignment is fine, otherwise it has too much hanging indentation when the content is more than one line.

    I am going to see if I can simply remove it from the numbering generation without breaking anything else…

    Thanks,

    Garth

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.