How do I calculate beforeAutospacing?

David Thielen 3,121 Reputation points
2021-01-02T17:57:06.607+00:00

Hi all;

Ok, so I have the following in a doxument.xml:

 <w:spacing w:before="100" w:after="100" w:beforeAutospacing="1" w:afterAutospacing="1"/>

Reading the spec it says:

Specifies whether a consumer shall automatically determine the spacing before this paragraph based on its contents.
This automatic spacing shall match the spacing which would be applied to the paragraph in an HTML document where no explicit spacing before/after is specified.
If this attribute is specified, then any value in before or beforeLines is ignored, and the spacing is automatically determined by the consumer.

Now the "ignore before" part is clear.

But how am I supposed to determine what Word is doing for "a consumer shall automatically determine the spacing"? I'm trying to match the Word layout so I need to know what Word does in this case.

thanks - dave

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
139 questions
0 comments No comments
{count} votes

Accepted answer
  1. Hung-Chun Yu 976 Reputation points Microsoft Employee
    2021-01-28T01:03:22.893+00:00

    Hi Dave

    Thank you for the wait.

    Here is what I found out, "Auto spacing is only applied between two neighboring paragraphs. In table here, there are no neighbors".


2 additional answers

Sort by: Most helpful
  1. Hung-Chun Yu 976 Reputation points Microsoft Employee
    2021-01-03T03:56:37.197+00:00

    Hi David

    Thank you for contacting Microsoft Open Specifications Support.

    I found an answer from earlier post

    It appears that if paragraph spacing is set to Auto and no layout option defaults have been changed with Word 2013 and later, then auto uses a default html-style spacing of 0em before and 1em after the paragraph.

    If the layout option "Don't use HTML paragraph auto spacing" is checked, then the relative value is converted to 5 pts before and 10 pts after.

    Additional References

    (1) http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing.donotusehtmlparagraphautospacing(v=office.14).aspx

    (2) http://webdesign.about.com/od/typemeasurements/qt/how-big-is-an-em.htm

    (3) http://www.boutell.com/newfaq/creating/paragraphspacing.html

    0 comments No comments

  2. David Thielen 3,121 Reputation points
    2021-01-03T13:27:12.347+00:00

    Hi HungChun;

    Please take a look at ATE-4694.docx. For the paragraphs of text, it does look like 1 em spacing between (in this case 12 points). Thank you on this part.

    But look at the text in the table. It does not have that spacing after each paragraph in the cell. But if the paragraphs in there are explicitly assigned 12 pts following, then you do get spacing.

    Any idea what's going on here?

    thanks - dave


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.