Esempio n. 1
0
        protected override HtmlItem renderingHtmlLi(HtmlItem it, ref Paragraph par, HtmlItem parent)
        {
            HtmlLi  l = it as HtmlLi;
            if (l != null)
            {
                foreach (HtmlItem i in it.ListItem)
                {
                 FormattedText ff = new FormattedText();
                 HtmlItem itemrendered =   renderingit(i, ref par, l, null);
                 HtmlText textitem = itemrendered as HtmlText;
                 //RenderStyle.CreateRenderStyle(it, ref ff).Render();

                 if (textitem != null)
                 {
                     ff.Add(new Text(textitem.Text));
                     par.Add(ff);
                     it.SizeRenderItem.Width = calculateWithText(textitem.Text.Length, ff.Size);

                     if (it.SizeRenderItem.Width > 210)
                         it.SizeRenderItem.Width = 210;
                     it.SizeRenderItem.Height = calculateHeightText(textitem.Text.Length, ff.Size);

                 }
                }
            }

            return l;
        }
Esempio n. 2
0
        protected override HtmlItem renderingHtmlDiv(HtmlItem it, ref Paragraph par, HtmlItem parent)
        {
            HtmlDiv div = it as HtmlDiv;
            if (div != null)
            {
                foreach (HtmlItem t in it.ListItem)
                {
                    FormattedText ff = new FormattedText();
                    RenderStyle.CreateRenderStyle(it, ref ff).Render(); //Render styles element

                    HtmlItem itemrendered = renderingit(t, ref par, it, null);
                    HtmlText textitem = itemrendered as HtmlText;
                    if (textitem != null)
                    {
                        ff.Add(new Text(textitem.Text));
                        it.SizeRenderItem.Width = calculateWithText(textitem.Text.Length, ff.Size);
                        if (it.SizeRenderItem.Width > 210)
                            it.SizeRenderItem.Width = 210;
                        it.SizeRenderItem.Height = calculateHeightText(textitem.Text.Length, ff.Size);
                    }

                    par.Add(ff);

                }
                par.AddLineBreak();
            }
            return div;
        }
Esempio n. 3
0
        protected override HtmlItem renderingHtmlContent(HtmlItem it, ref Paragraph par, HtmlItem parent)
        {
            HtmlContent content = it as HtmlContent;
            if (content != null)
            {
                if (parent is HtmlContent)
                    par.AddLineBreak();

                foreach (HtmlItem t in it.ListItem)
                {
                    FormattedText ff = new FormattedText();
                    if (content.Bold.hasValue())
                        ff.Bold = content.Bold.Value;
                    if (content.Size.hasValue())
                        ff.Size = content.Size.Value;

                    RenderStyle.CreateRenderStyle(it, ref ff).Render();

                    HtmlItem itemrendered = renderingit(t, ref par, it, null);
                    HtmlText textitem = itemrendered as HtmlText;
                    if (textitem != null)
                    {
                        ff.Add(new Text(textitem.Text));
                        par.Add(ff);
                        it.SizeRenderItem.Width = calculateWithText(textitem.Text.Length, ff.Size);

                        //ff.Section.PageSetup.PageWidth=59 =>>210 mm A4
                        if (it.SizeRenderItem.Width > 210)
                            it.SizeRenderItem.Width = 210;
                        it.SizeRenderItem.Height = calculateHeightText(textitem.Text.Length, ff.Size);

                    }
                }
                par.AddLineBreak();
            }
            return content;
        }
Esempio n. 4
0
        protected override HtmlItem renderingHtmlSpan(HtmlItem it, ref Paragraph par, HtmlItem parent)
        {
            HtmlSpan span = it as HtmlSpan;
            if (span != null)
            {
                foreach (HtmlItem t in it.ListItem)
                {
                    FormattedText ff = new FormattedText();
                    if (span.Size.hasValue())
                        ff.Size = span.Size.Value;
                    if (span.Bold.hasValue())
                        ff.Bold = span.Bold.Value;
                    if (span.Sub.hasValue())
                        ff.Subscript = span.Sub.Value;
                    if (span.Super.hasValue())
                        ff.Superscript = span.Super.Value;

                    RenderStyle.CreateRenderStyle(it, ref ff).Render(); // render styles element

                    HtmlItem itemrendered = renderingit(t, ref par, it, null);
                    HtmlText textitem = itemrendered as HtmlText;
                    if (textitem != null)
                    {
                        ff.Add(new Text(textitem.Text));
                        it.SizeRenderItem.Width = calculateWithText(textitem.Text.Length, ff.Size);
                        if (it.SizeRenderItem.Width > 210)
                            it.SizeRenderItem.Width = 210;
                        it.SizeRenderItem.Height = calculateHeightText(textitem.Text.Length, ff.Size);
                    }

                    par.Add(ff);

                }
            }
            return span;
        }