public void ClearText_OnFooterWhitSomeText_Ok() { Margin aBodyMargin = new Margin(MarginAlign.FOOTER, someTexts); aBodyMargin.SetText(aText); aBodyMargin.ClearText(); Assert.IsFalse(aBodyMargin.HasText()); }
public string Generate(Document document, Format format) { StringBuilder htmlGenerated = new StringBuilder("<html>"); StyleClass styleClassDocument = format.GetStyleClass(document.OwnStyleClass); Margin header = document.GetDocumentMargin(MarginAlign.HEADER); Margin footer = document.GetDocumentMargin(MarginAlign.FOOTER); List <Paragraph> paragraphs = document.DocumentParagraphs; if (header != null && header.HasText()) { Text headerText = header.GetText(); StyleClass styleClassHeader = GetStyleClassForDocumentPart(header.OwnStyleClass, format, styleClassDocument); StyleClass styleClassText = GetStyleClassForDocumentPart(headerText.OwnStyleClass, format, styleClassHeader); htmlGenerated.Append(ApplyStyleClassToText(headerText.TextContent, styleClassText)); } foreach (Paragraph paragraph in paragraphs) { StyleClass styleClassBody = GetStyleClassForDocumentPart(paragraph.OwnStyleClass, format, styleClassDocument); foreach (Text text in paragraph.Texts) { StyleClass styleClassText = GetStyleClassForDocumentPart(text.OwnStyleClass, format, styleClassBody); htmlGenerated.Append(ApplyStyleClassToText(text.TextContent, styleClassText)); } } if (footer != null && footer.HasText()) { Text footerText = footer.GetText(); StyleClass styleClassFooter = GetStyleClassForDocumentPart(footer.OwnStyleClass, format, styleClassDocument); StyleClass styleClassText = GetStyleClassForDocumentPart(footerText.OwnStyleClass, format, styleClassFooter); htmlGenerated.Append(ApplyStyleClassToText(footerText.TextContent, styleClassText)); } htmlGenerated.Append("</html>"); return(htmlGenerated.ToString()); }