EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
286 stars 50 forks source link

Incorrectly setting the LineSpacingRule property for paragraph. #146

Closed tarakanman closed 1 year ago

tarakanman commented 1 year ago

After changing the "LineSpacingRule" property, the structure of the document is violated, since the value being set is written to the "After" property.

PrzemyslawKlys commented 1 year ago

Can you provide some code to reproduce/point where is the problem or make a PR if you know how?

tarakanman commented 1 year ago

using (var doc = WordDocument.Create()) { doc.CompatibilitySettings.CompatibilityMode = CompatibilityMode.Word2010; var paragraph = doc.AddParagraph("Test") paragraph.LineSpacing = 360; paragraph.LineSpacingRule = DocumentFormat.OpenXml.Wordprocessing.LineSpacingRuleValues.Exact; doc.Save("OfficeIMO.docx", true); }

As a result, the paragraph properties in the document look like this:

**

</w:pPr>**

Should be:

**

</w:pPr>**