Пример #1
0
        private void WriteHelpFile()
        {
            using (HTMLBuilder builder = new HTMLBuilder(new HTMLDocument()))
            {
                builder.HeadBuilder
                .SetTitle("Tama Chan Documentation")
                .SetCSS(CreateCSS());

                builder.BodyBuilder.AddTag(CreateNavigationIndex());

                GenericContainerBuilder mainDiv = GenericContainerBuilder.CreateDiv().SetClass("content") as GenericContainerBuilder;
                TableBuilder[]          tables  = CreateTables();

                foreach (TableBuilder table in tables)
                {
                    mainDiv.TagContentBuilder.AddTag(table);
                }
                builder.BodyBuilder.AddTag(mainDiv);

                File.WriteAllText(HTML_HELP_FILE_PATH, builder.BuildHTML());
            }

            commands.Clear();
        }
Пример #2
0
        public void BuilderTest()
        {
            HTMLBuilder builder = new HTMLBuilder();

            /*builder.PushElement("div");
             * builder.AddAttribute("margin", "4 4 4 4");
             * builder.SetValue("Hello World!");
             * builder.PopElement();*/
            builder.PushElement("html");

            builder.PushElement("head");

            builder.PushElement("style");
            builder.SetValue("table, th, td { border: 1px solid black; border-collapse: collapse;} th, td { padding: 10px; }");
            builder.PopElement();

            builder.PopElement();

            builder.PushElement("body");

            builder.PushElement("table");

            builder.PushElement("tr");

            builder.PushElement("th");
            builder.SetValue("Header1");
            builder.PopElement();

            builder.PushElement("th");
            builder.SetValue("Header2");
            builder.PopElement();

            builder.PushElement("th");
            builder.SetValue("Header3");
            builder.PopElement();

            builder.PopElement();

            builder.PushElement("tr");

            builder.PushElement("td");
            builder.SetValue("Data1");
            builder.PopElement();

            builder.PushElement("td");
            builder.SetValue("Data2");
            builder.PopElement();

            builder.PushElement("td");
            builder.SetValue("Data3");
            builder.PopElement();

            builder.PopElement();

            builder.PopElement();

            builder.PopElement();

            builder.PopElement();


            Console.WriteLine(builder.BuildHTML());
        }