private void ConvertHtml(ExCSS.Stylesheet sheet, string html, Section section)
        {
            _sheet = sheet;
            if (string.IsNullOrEmpty(html))
            {
                throw new ArgumentNullException("html");
            }

            if (section == null)
            {
                throw new ArgumentNullException("section");
            }

            //section.PageSetup.HeaderDistance = "0.001cm";
            section.PageSetup.FooterDistance = Unit.FromCentimeter(0.01);

 // Create a paragraph with centered page number. See definition of style "Footer".
            var footer = section.Footers.Primary.AddParagraph();
            //section.Footers.Primary.
            footer.Format.Alignment = ParagraphAlignment.Right;
            footer.AddPageField();
            footer.AddText(" of ");
            footer.AddNumPagesField();
            
            var doc = new HtmlDocument();
            doc.LoadHtml(html);
            ConvertHtmlNodes(doc.DocumentNode.ChildNodes, sheet, section);
        }
Example #2
0
        public Section AddHtml(ExCSS.Stylesheet sheet, string contents, IConverter converter)
        {
            if (string.IsNullOrEmpty(contents))
            {
                throw new ArgumentNullException("contents");
            }
            if (converter == null)
            {
                throw new ArgumentNullException("converter");
            }

            Action <Section> addAction = converter.Convert(sheet, contents);

            addAction(this);
            return(this);
        }