onizet / html2openxml

Html2OpenXml is a small .Net library that convert simple or advanced HTML to plain OpenXml components. This program has started in 2009, initially to convert user's comments into templated Word.
MIT License
321 stars 109 forks source link

property line-height #52

Closed carcinos93 closed 1 month ago

carcinos93 commented 5 years ago

hi everyone. i've tried to use line-height property, but doesn't work. I wonder if property can be used?

Thanks for all!!

UPDATE: I did this for solve my problem.

I added this in Converter.cs

public static SpacingBetweenLines ToSpacingBetweenLines(string html) { if (html == null) return null; SpacingBetweenLines spacingBetweenLines = new SpacingBetweenLines(); spacingBetweenLines.LineRule = LineSpacingRuleValues.Exact; Unit unit = Unit.Parse(html); if (unit.IsValid || unit.Value > 0) spacingBetweenLines.Line = (unit.Value * 20.0).ToString();

        //spacingBetweenLines.Before ="0";
        //spacingBetweenLines.After = "0";

        return spacingBetweenLines;

    }

Edit 2 ParagraphStyleCollection.cs attrValue = en.StyleAttributes["line-height"]; if (attrValue != null && en.CurrentTag != "") { var spacing = Converter.ToSpacingBetweenLines(attrValue); if (spacing != null) { containerStyleAttributes.Add(spacing); } }