コード例 #1
0
        public static void Run()
        {
            // ExStart:AddHTMLUsingDOM
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            // Instantiate Document object
            Document doc = new Document();
            // Add a page to pages collection of PDF file
            Page page = doc.Pages.Add();
            // Instantiate HtmlFragment with HTML contnets
            HtmlFragment titel = new HtmlFragment("<fontsize=10><b><i>Table</i></b></fontsize>");
            // Set bottom margin information
            titel.Margin.Bottom = 10;
            // Set top margin information
            titel.Margin.Top = 200;
            // Add HTML Fragment to paragraphs collection of page
            page.Paragraphs.Add(titel);

            dataDir = dataDir + "AddHTMLUsingDOM_out.pdf";
            // Save PDF file
            doc.Save(dataDir);

            // ExEnd:AddHTMLUsingDOM            
            Console.WriteLine("\nHTML using DOM added successfully.\nFile saved at " + dataDir);
        }
コード例 #2
0
        public void Should_render_only_its_children()
        {
            var fragment = new HtmlFragment();
            fragment.Children.Add(new HtmlElement("a"));

            fragment.ToString().ShouldEqual("<a></a>");
        }
コード例 #3
0
        public IHtmlNode CreateSections(GridPagerData section)
        {
            var fragment = new HtmlFragment();

            pagingSectionsBuilder.CreateSections(section).AppendTo(fragment);

            return fragment;
        }
コード例 #4
0
        public void Should_append_to_container()
        {
            var fragment = new HtmlFragment();
            var container = new HtmlElement("div");

            fragment.AppendTo(container);

            container.Children[0].ShouldBeSameAs(fragment);
        }
コード例 #5
0
        public IHtmlNode Build()
        {
            var fragment = new HtmlFragment();

            RadioButton().AppendTo(fragment);
            Label().AppendTo(fragment);

            return fragment;
        }
コード例 #6
0
        public virtual IHtmlNode Create(GridPagerData section)
        {
            var fragment = new HtmlFragment();

            pagerSections.CreateSections(section).AppendTo(fragment);

            statusBuilder.Create(section).AppendTo(fragment);

            return fragment;
        }
コード例 #7
0
        public IHtmlNode CreateRow()
        {
            var container = new HtmlFragment();
            foreach (var builder in rowBuilders)
            {
                builder.CreateRow().AppendTo(container);
            }

            return container;
        }
コード例 #8
0
        public IHtmlNode Build()
        {
            var fragment = new HtmlFragment();

            Checkbox().AppendTo(fragment);
            Label().AppendTo(fragment);
            HiddenInput().AppendTo(fragment);

            return fragment;
        }
コード例 #9
0
ファイル: HtmlNodeFactory.cs プロジェクト: ajayumi/Jumony
    public HtmlFragment ParseFragment( string html )
    {
      var document = new AP.HtmlDocument();

      document.LoadHtml( html );

      var fragment = new HtmlFragment( this );
      fragment.AddCopies( document.AsDocument().Nodes() );

      return fragment;
    }
コード例 #10
0
        public IHtmlNode CreateSections(GridPagerData section)
        {
            var container = new HtmlFragment();

            AppendFirstPrevButtons(container, section.UrlBuilder, section);
            AppendNumericSection(container, section.UrlBuilder, section);
            AppendPageInput(container, section);
            AppendNextLast(container, section.UrlBuilder, section);
            AppendPageSizeDropDown(container, section);

            return container;
        }
コード例 #11
0
        private void AppendText(IHtmlNode td)
        {
            var p = new HtmlElement("p").AddClass(UIPrimitives.ResetStyle)
                .AppendTo(td);

            new HtmlElement("a").AddClass(UIPrimitives.Icon, "k-i-collapse")
                .Attribute("href", "#")
                .AppendTo(p);

            var fragment = new HtmlFragment().AppendTo(p);

            template(fragment);
        }
コード例 #12
0
        public IHtmlNode CreateSections(GridPagerData section)
        {
            var currentPage = section.CurrentPage;
            var pageCount = section.PageCount;

            var container = new HtmlFragment();
            var style = section.Style;

            AppendFirstPrevButtons(container, style, section.UrlBuilder, currentPage);
            AppendNumericSection(container, style, section.UrlBuilder, section.CurrentPage, section.PageCount);
            AppendPageSizeDropDown(container, style, section);
            AppendPageInput(container, style, section);
            AppendNextLast(container, style, section.UrlBuilder, currentPage, pageCount);
            return container;
        }
コード例 #13
0
        public override IHtmlNode Create(object dataItem)
        {
            var fragment = new HtmlFragment();

            if (ShouldAppendDataKeys)
            {
                AppendDataKeys(fragment, dataItem);
            }

            var button = base.Create(dataItem);

            button.AppendTo(fragment);

            return fragment;
        }
コード例 #14
0
ファイル: GridPagerBuilder.cs プロジェクト: wanaxe/Study
        public virtual IHtmlNode Create(GridPagerData section)
        {
            var fragment = new HtmlFragment();

            pagerSections.CreateSections(section).AppendTo(fragment);

            if (section.Refresh)
            {
                refreshBuilder.Create(section.UrlBuilder.SelectUrl(), section.Messages.Refresh).AppendTo(fragment);
            }

            if (section.Info)
            {
                statusBuilder.Create(section).AppendTo(fragment);
            }

            return fragment;
        }
コード例 #15
0
        public void Should_render_as_empty_if_no_children()
        {
            var fragment = new HtmlFragment();

            fragment.InnerHtml.ShouldBeEmpty();
        }
コード例 #16
0
        public static void Run()
        {
            // ExStart:CreateMultiColumnPdf
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            Document doc = new Document();
            // Specify the left margin info for the PDF file
            doc.PageInfo.Margin.Left = 40;
            // Specify the Right margin info for the PDF file
            doc.PageInfo.Margin.Right = 40;
            Page page = doc.Pages.Add();

            Aspose.Pdf.Drawing.Graph graph1 = new Aspose.Pdf.Drawing.Graph(500, 2);
            // Add the line to paraphraphs collection of section object
            page.Paragraphs.Add(graph1);

            // Specify the coordinates for the line
            float[] posArr = new float[] { 1, 2, 500, 2 };
            Aspose.Pdf.Drawing.Line l1 = new Aspose.Pdf.Drawing.Line(posArr);
            graph1.Shapes.Add(l1);
            // Create string variables with text containing html tags

            string s = "<font face=\"Times New Roman\" size=4>" +

            "<strong> How to Steer Clear of money scams</<strong> "
            + "</font>";
            // Create text paragraphs containing HTML text

            HtmlFragment heading_text = new HtmlFragment(s);
            page.Paragraphs.Add(heading_text);

            Aspose.Pdf.FloatingBox box = new Aspose.Pdf.FloatingBox();
            // Add four columns in the section
            box.ColumnInfo.ColumnCount = 2;
            // Set the spacing between the columns
            box.ColumnInfo.ColumnSpacing = "5";

            box.ColumnInfo.ColumnWidths = "105 105";
            TextFragment text1 = new TextFragment("By A Googler (The Official Google Blog)");
            text1.TextState.FontSize = 8;
            text1.TextState.LineSpacing = 2;
            box.Paragraphs.Add(text1);
            text1.TextState.FontSize = 10;

            text1.TextState.FontStyle = FontStyles.Italic;
            // Create a graphs object to draw a line
            Aspose.Pdf.Drawing.Graph graph2 = new Aspose.Pdf.Drawing.Graph(50, 10);
            // Specify the coordinates for the line
            float[] posArr2 = new float[] { 1, 10, 100, 10 };
            Aspose.Pdf.Drawing.Line l2 = new Aspose.Pdf.Drawing.Line(posArr2);
            graph2.Shapes.Add(l2);

            // Add the line to paragraphs collection of section object
            box.Paragraphs.Add(graph2);

            TextFragment text2 = new TextFragment(@"Sed augue tortor, sodales id, luctus et, pulvinar ut, eros. Suspendisse vel dolor. Sed quam. Curabitur ut massa vitae eros euismod aliquam. Pellentesque sit amet elit. Vestibulum interdum pellentesque augue. Cras mollis arcu sit amet purus. Donec augue. Nam mollis tortor a elit. Nulla viverra nisl vel mauris. Vivamus sapien. nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et,nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim Nam justo lorem, aliquam luctus, sodales et, semper sed, enim nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.nAenean posuere ante ut neque. Morbi sollicitudin congue felis. Praesent turpis diam, iaculis sed, pharetra non, mollis ac, mauris. Phasellus nisi ipsum, pretium vitae, tempor sed, molestie eu, dui. Duis lacus purus, tristique ut, iaculis cursus, tincidunt vitae, risus. Sed commodo. *** sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed urna. . Duis convallis ultrices nisi. Maecenas non ligula. Nunc nibh est, tincidunt in, placerat sit amet, vestibulum a, nulla. Praesent porttitor turpis eleifend ante. Morbi sodales.");
            box.Paragraphs.Add(text2);

            page.Paragraphs.Add(box);

            dataDir = dataDir + "CreateMultiColumnPdf_out.pdf";
            // Save PDF file
            doc.Save(dataDir);
            // ExEnd:CreateMultiColumnPdf            
            Console.WriteLine("\nMulti column pdf file created successfully.\nFile saved at " + dataDir);
        }
コード例 #17
0
ファイル: XFormHelper.cs プロジェクト: dnasir/EPi.Extensions
 private static bool IsTableFragment(HtmlFragment htmlFragment)
 {
     var tableTags = new[] {"table", "tr", "td", "thead", "tfoot", "tbody"};
     return tableTags.Contains(htmlFragment.Name);
 }
コード例 #18
0
ファイル: XFormHelper.cs プロジェクト: dnasir/EPi.Extensions
        /// <summary>
        ///     Replaces XForm HTML tables with more semantic markup.
        /// </summary>
        /// <param name="htmlFragment">HtmlFragment of XForm</param>
        /// <param name="addClassAttribute">
        ///     Will add individual HTML class for each element.
        ///     For matching HTML classes see <see cref="XFormHelper.TableTagCssClasses" />
        /// </param>
        /// <param name="numTableColumns">Number of columns in the XForm table. Use GetNumberOfTableColumns to retrieve the value.</param>
        /// <returns>Modified HtmlFragment</returns>
        public static HtmlFragment CleanupXFormHtmlMarkup(HtmlFragment htmlFragment, bool addClassAttribute = true, int numTableColumns = 1)
        {
            var originalTag = htmlFragment.Name;

            if (!IsTableFragment(htmlFragment))
            {
                return htmlFragment;
            }

            htmlFragment.Name = "div";
            var elFragment = htmlFragment as ElementFragment;

            if (elFragment != null)
            {
                RemoveAttribute(elFragment, "valign");

                if (addClassAttribute)
                {
                    AddClassAttribute(originalTag, elFragment, numTableColumns);
                }
            }

            return htmlFragment;
        }
コード例 #19
0
ファイル: CommonTestBase.cs プロジェクト: JamesDunne/ivo-cms
 protected void output(HtmlFragment fragment)
 {
     Console.WriteLine(((string)fragment).Replace("\n", Environment.NewLine));
 }