Example #1
0
        public void TestH1Fluent()
        {
            Heading1 h1 = Heading1.With("h1").Create();

            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:p wsp:rsidR*"));
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:t>h1</w:t>"));
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "</w:p>"));
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:pStyle w:val=\"Heading1\" />"));
        }
Example #2
0
        public void TestH1Style()
        {
            Heading1 h1 = (Heading1)Heading1.With("222222").WithStyle().Bold().Italic().Create();

            Assert.AreEqual(2, TestUtils.RegexCount(h1.Content, "<*w:rPr>"));
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:jc w:val=\"left\" />")); //default is left
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:b/>"));
            Assert.AreEqual(1, TestUtils.RegexCount(h1.Content, "<w:i/>"));
        }
        public void TestAddElementAliasString()
        {
            IDocument myDoc = new Document2004();

            myDoc.AddEle(Heading1.With("heading1").Create().Content);

            Assert.True(myDoc.Body.Content.Contains("<w:body>"));
            Assert.True(myDoc.Body.Content.Contains("<w:t>heading1</w:t>"));
            Assert.True(myDoc.Body.Content.Contains("</w:body>"));
        }
Example #4
0
        public void TestFluent()
        {
            Heading1 h1 = (Heading1)Heading1.With("h111").WithStyle().Bold().Italic().Align(Align.CENTER).Create();
            Heading2 h2 = (Heading2)Heading2.With("h222").WithStyle().Bold().Italic().Align(Align.CENTER).Create();
            Heading3 h3 = (Heading3)Heading3.With("h222").WithStyle().Bold().Italic().Align(Align.CENTER).Create();

            verifyStyles(h1);
            verifyStyles(h2);
            verifyStyles(h3);
        }
Example #5
0
        private static void ReadHeading1Property(ref Utf8JsonReader reader, Heading1 heading1, string propertyName)
        {
            switch (propertyName)
            {
            case Constants.Heading1Property.Text:
                heading1.Text = JsonSerializer.Deserialize <RichText[]>(ref reader);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(propertyName), propertyName, null);
            }
        }
        public void TestBasicHeadingStyle()
        {
            IDocument myDoc = new Document2004();
            Heading1 h1 = new Heading1("Heading 111");
            HeadingStyle headingStyle = new HeadingStyle();
            headingStyle.Align(Align.CENTER);
            headingStyle.Italic();

            h1.Style = headingStyle;
            myDoc.Body.AddEle(h1);

            myDoc.Body.AddEle(new Heading2("Heading 222"));
            myDoc.Body.AddEle(new Heading3("Heading 333"));
        }
Example #7
0
        public void TestEmpty()
        {
            Heading1 h1 = Heading1.With("");

            Assert.AreEqual("", h1.Content);

            Heading2 h2 = Heading2.With("");

            Assert.AreEqual("", h2.Content);

            Heading3 h3 = Heading3.With("");

            Assert.AreEqual("", h3.Content);
        }
        [Test] //TODO: make this useful with assertions
        public void TestBasicHeadingStyle()
        {
            IDocument    myDoc        = new Document2004();
            Heading1     h1           = new Heading1("Heading 111");
            HeadingStyle headingStyle = new HeadingStyle();

            headingStyle.Align(Align.CENTER);
            headingStyle.Italic();

            h1.Style = headingStyle;
            myDoc.Body.AddEle(h1);

            myDoc.Body.AddEle(new Heading2("Heading 222"));
            myDoc.Body.AddEle(new Heading3("Heading 333"));
        }
        public void SanityTest()
        {
            Heading1 heading1 = new Heading1("h111");
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:p wsp:rsidR*"));
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:t>[{]value[}]</w:t>"));
                //it has to have the pace holder
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "</w:p>"));
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:pStyle w:val=\"Heading1\" />"));
                // it has to replace the Type of Heading

            Assert.NotNull(heading1.Style);
            HeadingStyle style = new HeadingStyle();
            heading1.Style = style;
            Assert.NotNull(heading1.Style);
        }
Example #10
0
        [Test] //TODO: make this useful with assertions
        public void TestBasicHeadingFluent()
        {
            IDocument doc = new Document2004();
            Heading1  h1  = (Heading1)Heading1.With("h111").WithStyle()
                            .Bold().Italic()
                            .Align(Align.CENTER).Create();

            Heading2 h2 = (Heading2)Heading2.With("h222").WithStyle()
                          .Bold().Italic().Create();

            doc.Body.AddEle(h1);
            doc.Body.AddEle(h2);
            doc.Body.AddEle(
                Heading1.With("h3333").WithStyle().Bold()
                .Italic().Create());     // no cast...
        }
        public void SanityTest()
        {
            Heading1 heading1 = new Heading1("h111");

            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:p wsp:rsidR*"));
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:t>[{]value[}]</w:t>"));
            //it has to have the pace holder
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "</w:p>"));
            Assert.AreEqual(1, TestUtils.RegexCount(heading1.Template, "<w:pStyle w:val=\"Heading1\" />"));
            // it has to replace the Type of Heading

            Assert.NotNull(heading1.Style);
            HeadingStyle style = new HeadingStyle();

            heading1.Style = style;
            Assert.NotNull(heading1.Style);
        }
Example #12
0
 public override void Dispose()
 {
     base.Dispose();
     _elmBody                  = null;
     _elmDescription           = null;
     _elmDescriptionImage      = null;
     _elmDescriptionImageCont  = null;
     _elmDisabledInfo          = null;
     _elmDisabledInfoIcon      = null;
     _elmDisabledInfoTitle     = null;
     _elmDisabledInfoTitleText = null;
     _elmFooter                = null;
     _elmFooterIcon            = null;
     _elmFooterIconCont        = null;
     _elmFooterTitleText       = null;
     _elmInnerDiv              = null;
     _elmTitle                 = null;
     _elmSelectedItemTitle     = null;
 }
Example #13
0
        static void Main(string[] args)
        {
            IDocument myDoc = new Document2004();

            Properties prop = new Properties
            {
                //AppName = "Sharp2Word",
                Author    = "Dublicator",
                LastSaved = DateTime.Now
            };

            myDoc.Head.Properties = prop;

            myDoc.AddEle(BreakLine.SetTimes(1).Create());             // this is one breakline

            //Headings
            myDoc.AddEle(Heading2.With("===== Headings ======").Create());
            myDoc.AddEle(
                Paragraph.With(
                    "This doc has been generated by Sharp2Word.")
                .Create());
            myDoc.AddEle(BreakLine.SetTimes(1).Create());

            myDoc.AddEle(Paragraph
                         .With("I will try to use a little bit of everything in the API Sharp2word. " +
                               "I realised that is very dificult to keep the documentation updated " +
                               "so this is where I will demostrate how to do some cool things with Sharp2Word!")
                         .Create());


            myDoc.AddEle(Heading1.With("Heading01 without styling").Create());
            myDoc.AddEle(Heading2.With("Heading02 with styling").WithStyle()
                         .Align(Align.CENTER).Italic().Create());
            myDoc.AddEle(Heading3.With("Heading03").WithStyle().Bold()
                         .Align(Align.RIGHT).Create());

            //Paragraph and ParagrapPiece
            myDoc.AddEle(Heading2.With("===== Paragraph and ParagrapPiece ======").Create());
            myDoc.AddEle(Paragraph.With("I am a very simple paragraph.").Create());

            myDoc.AddEle(BreakLine.SetTimes(1).Create());
            ParagraphPiece myParPiece01 =
                ParagraphPiece.With(
                    "If you use the class 'Paragraph', you will have limited style. Maybe only paragraph aligment.");
            ParagraphPiece myParPiece02 =
                ParagraphPiece.With("In order to use more advanced style, you have to use ParagraphPiece");
            ParagraphPiece myParPiece03 =
                ParagraphPiece.With(
                    "One example of this is when you want to make ONLY one word BOLD or ITALIC. the way to to this is create many pieces, format them separetely and put all together in a Paragraph object. Example:");

            myDoc.AddEle(Paragraph.WithPieces(myParPiece01, myParPiece02, myParPiece03).Create());

            ParagraphPiece myParPieceJava  = ParagraphPiece.With("I like C# and ").WithStyle().Font(Font.COURIER).Create();
            ParagraphPiece myParPieceRuby  = ParagraphPiece.With("Ruby!!! ").WithStyle().Bold.Italic.Create();
            ParagraphPiece myParPieceAgile =
                ParagraphPiece.With("I actually love C#, TDD, patterns... ").WithStyle().
                TextColor("008000").Create();

            myDoc.AddEle(Paragraph.WithPieces(myParPieceJava, myParPieceRuby, myParPieceAgile).Create());

            //font size
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("No size").Create(),
                                              ParagraphPiece.With("I am size 50.").WithStyle().FontSize(50).TextColor(System.Drawing.Color.Cyan).Create()));

            //Document Header and Footer
            myDoc.AddEle(BreakLine.SetTimes(2).Create());
            myDoc.AddEle(Heading2.With("===== Document Header and Footer ======").Create());
            myDoc.AddEle(Paragraph.With("By default everything is added to the Body when you do 'myDoc.AddEle(...)'." +
                                        " But you can add elements to the Header and/or Footer. Other cool thing is show page number or not.")
                         .Create());

            myDoc.AddEle(BreakLine.SetTimes(2).Create());
            myDoc.AddEle(
                Paragraph.With(
                    "Page number is displayed by default but you can disable: 'myDoc.getFooter().showPageNumber(false)' ")
                .Create());

            myDoc.AddEle(BreakLine.SetTimes(2).Create());
            myDoc.AddEle(
                Paragraph.With(
                    "you can also hide Header and Footer in the first Page. This is useful for when you have a cover page.: 'myDoc.getHeader().SetHideHeaderAndFooterFirstPage(true)' ")
                .Create());

            myDoc.Header.AddEle(
                Paragraph.WithPieces(ParagraphPiece.With("I am in the"),
                                     ParagraphPiece.With(" Header ").WithStyle().Bold.Create(),
                                     ParagraphPiece.With("of all pages")).Create());

            myDoc.Footer.AddEle(Paragraph.With("I am in the Footer of all pages").Create());


            //Images
            myDoc.AddEle(BreakLine.SetTimes(1).Create());
            myDoc.AddEle(Heading2.With("===== Images ======").Create());
            myDoc.AddEle(
                Paragraph.With(
                    "Images can be created from diferent locations. It can be from your local machine, from web URL or classpath.")
                .Create());

            myDoc.AddEle(Paragraph.With("This one is coming from WEB, google web site: ").Create());
            //myDoc.AddEle(Image.From_WEB_URL("http://www.google.com/images/logos/ps_logo2.png"));

            myDoc.AddEle(BreakLine.SetTimes(2).Create());
            myDoc.AddEle(Paragraph.With("You can change the image dimensions:.").Create());
            //myDoc.AddEle(
            //			Image.From_WEB_URL("http://www.google.com/images/logos/ps_logo2.png").SetHeight(40).SetWidth(80).
            //			Create());


            myDoc.AddEle(BreakLine.SetTimes(2).Create());
            myDoc.AddEle(
                Paragraph.With(
                    "You can always be creative mixing up images inside other IElements. Eg.: Paragraphs, Tables, etc.")
                .Create());

            myDoc.AddEle(BreakLine.SetTimes(1).Create());


            //Table
            myDoc.AddEle(Heading2.With("===== Table ======").Create());
            myDoc.AddEle(
                Paragraph.With("Table os soccer playerd and their number of gols - the best of the best of all times:").
                Create());
            myDoc.AddEle(BreakLine.SetTimes(1).Create());

            Table tbl = new Table();

            tbl.AddTableEle(TableEle.TH, "Name", "Number of gols", "Country");

            tbl.AddTableEle(TableEle.TD, "Arthur Friedenreich", "1329", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Pele", "1281", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Romario", "1002", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Tulio Maravilha", "956", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Zico", "815", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Roberto Dinamite", "748", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Di Stéfano", "715", "Argentina");
            tbl.AddTableEle(TableEle.TD, "Puskas", "689", "Hungary");
            tbl.AddTableEle(TableEle.TD, "Flávio", "591", "Brazil");
            tbl.AddTableEle(TableEle.TD, "James McGory", "550", "Scotland");
            tbl.AddTableEle(TableEle.TD, "Leonardo Correa", "299", "Brazil/Australia");

            tbl.AddTableEle(TableEle.TF, "Total", "1,100,000.00", " ");

            myDoc.AddEle(tbl);

            myDoc.AddEle(BreakLine.SetTimes(1).Create());

            myDoc.AddEle(
                Paragraph.WithPieces(
                    ParagraphPiece.With("* Zico was mid-fieldfer and managed to score all those f*****g goals!").
                    WithStyle().Italic.Create()).Create());
            myDoc.AddEle(
                Paragraph.WithPieces(
                    ParagraphPiece.With(
                        "* Leonardo Correa's goals (me) include futsal, soccer, friendly games, training games, so on... (but not playstation)")
                    .WithStyle().Italic.Create()).Create());


            //PageBreaks
            myDoc.AddEle(Heading2.With("===== PageBreak ======").Create());
            myDoc.AddEle(Paragraph.With("There is a PAGE BREAK after this line:").Create());
            myDoc.AddEle(PageBreak.Create());
            myDoc.AddEle(Paragraph.With("There is a PAGE BREAK before this line:").Create());

            myDoc.Save("mytest.doc");
        }
Example #14
0
        /// <summary>
        /// Creates the HTML for the ToolTip.
        /// </summary>
        /// <owner alias="HillaryM" />
        internal override void RefreshInternal()
        {
            if (NeedsDelayIniting)
            {
                DoDelayedInit();
            }

            EnsureDOMElementAndEmpty();

            // set the aria role
            ElementInternal.SetAttribute("role", "tooltip");

            // set the aria visibility
            ElementInternal.SetAttribute("aria-hidden", "true");

            if (CUIUtility.IsNullOrUndefined(_elmBody))
            {
                _elmBody           = new Div();
                _elmBody.ClassName = "ms-cui-tooltip-body";
            }
            else
            {
                _elmBody = (Div)Utility.RemoveChildNodes(_elmBody);
            }
            ElementInternal.AppendChild(_elmBody);

            if (CUIUtility.IsNullOrUndefined(_elmInnerDiv))
            {
                _elmInnerDiv           = new Div();
                _elmInnerDiv.ClassName = "ms-cui-tooltip-glow";
                _elmBody.AppendChild(_elmInnerDiv);
            }
            else
            {
                _elmInnerDiv = (Div)Utility.RemoveChildNodes(_elmInnerDiv);
            }

            // set the title and shortcut
            if (CUIUtility.IsNullOrUndefined(_elmTitle))
            {
                _elmTitle = new Heading1();
                if (TitleInternal.Length > _controlTitleLength)
                {
                    UIUtility.SetInnerText(_elmTitle, TitleInternal.Substring(0, _controlTitleLength));
                }
                else
                {
                    UIUtility.SetInnerText(_elmTitle, Title);
                }
                _elmInnerDiv.AppendChild(_elmTitle);
            }

            // set the image if available
            if (CUIUtility.IsNullOrUndefined(_elmDescriptionImage) &&
                !string.IsNullOrEmpty(Properties.ToolTipImage32by32))
            {
                _elmDescriptionImage     = new Image();
                _elmDescriptionImageCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size32by32,
                    Properties.ToolTipImage32by32,
                    Properties.ToolTipImage32by32Class,
                    _elmDescriptionImage,
                    true,
                    false,
                    Properties.ToolTipImage32by32Top,
                    Properties.ToolTipImage32by32Left);
                _elmDescriptionImageCont.ClassName = _elmDescriptionImageCont.ClassName + " ms-cui-tooltip-bitmap ";
                _elmInnerDiv.AppendChild(_elmDescriptionImageCont);
            }

            // set the description
            string selectedItemTitle = Properties.ToolTipSelectedItemTitle;
            string descriptionText   = Description;

            if (CUIUtility.IsNullOrUndefined(_elmDescription) &&
                (!string.IsNullOrEmpty(descriptionText) ||
                 !string.IsNullOrEmpty(selectedItemTitle)))
            {
                _elmDescription           = new Div();
                _elmDescription.ClassName = "ms-cui-tooltip-description";
                if (!string.IsNullOrEmpty(Properties.ToolTipImage32by32))
                {
                    _elmDescription.Style.Width = "80%";
                }
                _elmInnerDiv.AppendChild(_elmDescription);

                string seletedItemTitlePrefix = Root.Properties.ToolTipSelectedItemTitlePrefix;
                if (!string.IsNullOrEmpty(selectedItemTitle) &&
                    !string.IsNullOrEmpty(seletedItemTitlePrefix))
                {
                    string selectedItemText = String.Format(seletedItemTitlePrefix, selectedItemTitle);
                    _elmSelectedItemTitle = new Paragraph();
                    UIUtility.SetInnerText(_elmSelectedItemTitle, selectedItemText);

                    _elmDescription.AppendChild(_elmSelectedItemTitle);
                    _spacerRow3 = new Break();
                    _elmDescription.AppendChild(_spacerRow3);
                }
                if (!string.IsNullOrEmpty(descriptionText))
                {
                    if (descriptionText.Length > _controlDescriptionLength)
                    {
                        _elmDescription.InnerHtml = _elmDescription.InnerHtml + Utility.HtmlEncodeAllowSimpleTextFormatting(descriptionText.Substring(0, _controlDescriptionLength), true);
                    }
                    else
                    {
                        _elmDescription.InnerHtml = _elmDescription.InnerHtml + Utility.HtmlEncodeAllowSimpleTextFormatting(descriptionText, true);
                    }
                }
            }

            // Disabled info explaining why a command is currently disabled
            if (CUIUtility.IsNullOrUndefined(_elmDisabledInfo) &&
                !CUIUtility.IsNullOrUndefined(_disabledInfoProperties) &&
                !string.IsNullOrEmpty(_disabledInfoProperties.Title))
            {
                // provide spacer to distinguish from main description above
                _spacerDiv1           = new Div();
                _spacerDiv1.ClassName = "ms-cui-tooltip-clear";
                _elmInnerDiv.AppendChild(_spacerDiv1);

                _spacerRow1 = new HorizontalRule();
                _elmInnerDiv.AppendChild(_spacerRow1);

                // title for this message
                _elmDisabledInfoTitle           = new Div();
                _elmDisabledInfoTitle.ClassName = "ms-cui-tooltip-footer";
                _elmInnerDiv.AppendChild(_elmDisabledInfoTitle);

                _elmDisabledInfoTitleText = new Div();
                UIUtility.SetInnerText(_elmDisabledInfoTitleText, _disabledInfoProperties.Title);

                // icon for this message
                _elmDisabledInfoIcon     = new Image();
                _elmDisabledInfoIconCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size16by16,
                    _disabledInfoProperties.Icon,
                    _disabledInfoProperties.IconClass,
                    _elmDisabledInfoIcon,
                    true,
                    false,
                    _disabledInfoProperties.IconTop,
                    _disabledInfoProperties.IconLeft);

                _elmDisabledInfoIconCont.Style.VerticalAlign = "top";

                // switch display based on text direction
                // REVIEW(jkern,josefl): I don't think that we need to manually do this.  We should get it for free in
                // the browser with the "dir=rtl" attribute.  Check this when the RTL work is done.
                if (Root.TextDirection == Direction.LTR)
                {
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoIconCont);
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoTitleText);
                }
                else
                {
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoTitleText);
                    _elmDisabledInfoTitle.AppendChild(_elmDisabledInfoIconCont);
                }

                // disabled info text
                if (!string.IsNullOrEmpty(_disabledInfoProperties.Description))
                {
                    _elmDisabledInfo             = new Div();
                    _elmDisabledInfo.ClassName   = "ms-cui-tooltip-description";
                    _elmDisabledInfo.Style.Width = "90%";
                    UIUtility.SetInnerText(_elmDisabledInfo, _disabledInfoProperties.Description);
                    _elmInnerDiv.AppendChild(_elmDisabledInfo);
                }
            }

            // set the footer
            if (!CUIUtility.IsNullOrUndefined(_elmFooter) &&
                !string.IsNullOrEmpty(Root.Properties.ToolTipFooterText) &&
                !string.IsNullOrEmpty(Root.Properties.ToolTipFooterImage16by16) &&
                (((!CUIUtility.IsNullOrUndefined(_disabledInfoProperties)) &&
                  (!string.IsNullOrEmpty(_disabledInfoProperties.HelpKeyWord))) ||
                 (!string.IsNullOrEmpty(Properties.ToolTipHelpKeyWord))))
            {
                _spacerDiv2           = new Div();
                _spacerDiv2.ClassName = "ms-cui-tooltip-clear";
                _elmInnerDiv.AppendChild(_spacerDiv2);

                _spacerRow2 = new HorizontalRule();
                _elmInnerDiv.AppendChild(_spacerRow2);

                _elmFooter           = new Div();
                _elmFooter.ClassName = "ms-cui-tooltip-footer";
                _elmInnerDiv.AppendChild(_elmFooter);

                _elmFooterTitleText = new Div();
                UIUtility.SetInnerText(_elmFooterTitleText, Root.Properties.ToolTipFooterText);

                _elmFooterIcon = new Image();

                _elmFooterIconCont = Utility.CreateClusteredImageContainerNew(
                    ImgContainerSize.Size16by16,
                    Root.Properties.ToolTipFooterImage16by16,
                    Root.Properties.ToolTipFooterImage16by16Class,
                    _elmFooterIcon,
                    true,
                    false,
                    Root.Properties.ToolTipFooterImage16by16Top,
                    Root.Properties.ToolTipFooterImage16by16Left
                    );

                _elmFooterIconCont.Style.VerticalAlign = "top";

                // switch display based on text direction
                // REVIEW(jkern,josefl): I don't think that we need to manually do this.  We should get it for free in
                // the browser with the "dir=rtl" attribute.  Check this when the RTL work is done.
                if (Root.TextDirection == Direction.LTR)
                {
                    _elmFooter.AppendChild(_elmFooterIconCont);
                    _elmFooter.AppendChild(_elmFooterTitleText);
                }
                else
                {
                    _elmFooter.AppendChild(_elmFooterTitleText);
                    _elmFooter.AppendChild(_elmFooterIconCont);
                }
            }

            // build DOM structure
            this.AppendChildrenToElement(_elmBody);
            base.RefreshInternal();
        }
Example #15
0
        static void Main()
        {
            IDocument myDoc = new Document2004();

            myDoc.Body.SetMarginBody(10, 10, 10, 10);
            // myDoc.setPageOrientationLandscape();// default is Portrait be can be
            // changed.

            // Headings
            myDoc.AddEle(Heading2.With("===== Headings ======").Create());
            myDoc.AddEle(Paragraph
                         .With("This doc has been generated by the unit test testJava2wordAllInOne() in the class DocumentTest2004Test.java.")
                         .Create());
            myDoc.AddEle(BreakLine.Times(1).Create());

            myDoc.AddEle(Paragraph
                         .With("I will try to use a little bit of everything in the API Java2word. "
                               + "I realised that is very dificult to keep the doucmentation updated "
                               + "so this is where I will demostrate how to do some cool things With Java2word!")
                         .Create());

            myDoc.AddEle(Heading1.With("Heading01 without styling").Create());
            myDoc.AddEle(Heading2.With("Heading02 With styling").WithStyle()
                         .Align(Align.CENTER).Italic().Create());
            myDoc.AddEle(Heading3.With("Heading03").WithStyle().Bold()
                         .Align(Align.RIGHT).Create());

            // Paragraph and ParagrapPiece
            myDoc.AddEle(Heading2.With("===== Paragraph and ParagrapPiece ======")
                         .Create());
            myDoc.AddEle(Paragraph.With("I am a very simple paragraph.").Create());

            myDoc.AddEle(BreakLine.Times(1).Create());
            ParagraphPiece myParPiece01 = ParagraphPiece
                                          .With("If you use the class 'Paragraph', you will have limited style. Maybe only paragraph aligment.");
            ParagraphPiece myParPiece02 = ParagraphPiece
                                          .With("In order to use more advanced style, you have to use ParagraphPiece");
            ParagraphPiece myParPiece03 = ParagraphPiece
                                          .With("One example of this is when you want to make ONLY one word BOLD or ITALIC. the way to to this is Create many pieces, format them separetely and put all together in a Paragraph object. Example:");

            myDoc.AddEle(Paragraph.WithPieces(myParPiece01, myParPiece02,
                                              myParPiece03).Create());

            ParagraphPiece myParPieceJava = ParagraphPiece.With("I like Java and ")
                                            .WithStyle().Font(WordFont.COURIER).Create();
            ParagraphPiece myParPieceRuby = ParagraphPiece.With("Ruby!!! ")
                                            .WithStyle().Bold().Italic().Create();
            ParagraphPiece myParPieceAgile = ParagraphPiece
                                             .With("I actually love Java, Ruby Agile, BDD, Cucumber, automation... ")
                                             .WithStyle().TextColor("008000").Create();

            myDoc.AddEle(Paragraph.WithPieces(myParPieceJava, myParPieceRuby,
                                              myParPieceAgile).Create());

            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Paragraph.WithPieces(
                             ParagraphPiece.With("This is a manual 'Bold' and 'Italic'")
                             .WithStyle().Font(WordFont.COURIER).Bold().Italic()
                             .Create()).Create());
            myDoc.AddEle(Paragraph
                         .WithPieces(
                             ParagraphPiece
                             .With("This is the SAME as the above line but With 'Smart' Bold/Align ")
                             .WithStyle().Font(WordFont.COURIER_BOLD_ITALIC)
                             .Create()).Create());
            myDoc.AddEle(BreakLine.Times(1).Create());

            // Font size
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("No size")
                                              .Create(), ParagraphPiece.With("I am size 24.").WithStyle()
                                              .FontSize(24).Create()));

            //ParagraphPiece and other format/styles
            myDoc.AddEle(BreakLine.Times(1).Create());
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("New ParagraphPiece styles have been implemented. Here they are:").WithStyle().FontSize(14).Create()));

            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Subscript").WithStyle().Subscript().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Superscript").WithStyle().Superscript().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Strike").WithStyle().Strike().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Caps").WithStyle().Caps().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("SmallCaps").WithStyle().SmallCaps().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("DoubleStrike").WithStyle().DoubleStrike().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Emboss").WithStyle().Emboss().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Imprint").WithStyle().Imprint().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Outline").WithStyle().Outline().Create()));
            myDoc.AddEle(Paragraph.WithPieces(ParagraphPiece.With("The Style is: ").Create(), ParagraphPiece.With("Shadow").WithStyle().Shadow().Create()));
            myDoc.AddEle(BreakLine.Times(2).Create());


            // Document Header and Footer
            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Heading2.With("===== Document Header and Footer ======")
                         .Create());
            myDoc.AddEle(Paragraph
                         .With("By default everything is added to the Body when you do 'myDoc.AddEle(...)'."
                               + " But you can add elements to the Header and/or Footer. Other cool thing is show page number or not.")
                         .Create());

            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Paragraph
                         .With("Page number is displayed by default but you can disable: 'myDoc.Footer().showPageNumber(false)' ")
                         .Create());

            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Paragraph
                         .With("you can also hide Header and Footer in the first Page. This is useful for when you have a cover page.: 'myDoc.Header.setHideHeaderAndFooterFirstPage(true)' ")
                         .Create());

            myDoc.Header.AddEle(
                Paragraph.WithPieces(
                    ParagraphPiece.With("I am in the"),
                    ParagraphPiece.With(" Header ").WithStyle().Bold()
                    .Create(), ParagraphPiece.With("of all pages"))
                .Create());

            myDoc.Footer.AddEle(
                Paragraph.With("I am in the Footer of all pages").Create());

            // Images
            myDoc.AddEle(BreakLine.Times(1).Create());
            myDoc.AddEle(Heading2.With("===== Images ======").Create());
            myDoc.AddEle(Paragraph
                         .With("Images can be created from diferent locations. It can be from your local machine, from web URL or classpath.")
                         .Create());

            myDoc.AddEle(Paragraph.With(
                             "This one is coming from WEB, google web site: ").Create());
            myDoc.AddEle(Image.FromUrl("http://www.google.com/images/logos/ps_logo2.png"));

            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Paragraph.With("You can change the image dimensions:.")
                         .Create());
            myDoc.AddEle(Image
                         .FromUrl("http://www.google.com/images/logos/ps_logo2.png")
                         .SetHeight(40).SetWidth(80).Create());

            myDoc.AddEle(BreakLine.Times(2).Create());
            myDoc.AddEle(Paragraph
                         .With("You can always be creative mixing up images inside other IElements. Eg.: Paragraphs, Tables, etc.")
                         .Create());

            /*myDoc.AddEle(Paragraph
             *      .With("This document inside the paragraph, coming from '/src/test/resources/dtpick.gif': "
             + Image.From_FULL_LOCAL_PATHL(
             +                      Util.AppRoot
             + "/src/test/resources/dtpick.gif")
             +                      .Content));*/

            myDoc.AddEle(BreakLine.Times(1).Create());

            // Table
            myDoc.AddEle(Heading2.With("===== Table ======").Create());
            myDoc.AddEle(Paragraph
                         .With("Table os soccer playerd and their number of gols - the best of the best of all Times:")
                         .Create());
            myDoc.AddEle(BreakLine.Times(1).Create());

            Table tbl = new Table();

            tbl.AddTableEle(TableEle.TH, "Name", "Number of gols", "Country");
            tbl.SetRepeatTableHeaderOnEveryPage();

            tbl.AddTableEle(TableEle.TD, "Arthur Friedenreich", "1329", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Pele", "1281", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Romario", "1002", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Tulio Maravilha", "956", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Zico", "815", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Roberto Dinamite", "748", "Brazil");
            tbl.AddTableEle(TableEle.TD, "Di Stéfano", "715", "Argentina");
            tbl.AddTableEle(TableEle.TD, "Puskas", "689", "Hungary");
            tbl.AddTableEle(TableEle.TD, "Flávio", "591", "Brazil");
            tbl.AddTableEle(TableEle.TD, "James McGory", "550", "Scotland");
            tbl.AddTableEle(TableEle.TD, "Leonardo Correa", "299",
                            "Brazil/Australia");

            tbl.AddTableEle(TableEle.TF, "Total", "1,100,000.00", " ");

            myDoc.AddEle(tbl);

            myDoc.AddEle(BreakLine.Times(1).Create());

            myDoc.AddEle(Paragraph
                         .WithPieces(
                             ParagraphPiece
                             .With("* Zico was mid-fieldfer and managed to score all those f*****g goals!")
                             .WithStyle().Italic().Create()).Create());
            myDoc.AddEle(Paragraph
                         .WithPieces(
                             ParagraphPiece
                             .With("* Leonardo Correa's goals (me) include futsal, soccer, friendly games, training games, so on... (but not playstation)")
                             .WithStyle().Italic().Create()).Create());

            // PageBreaks
            myDoc.AddEle(Heading2.With("===== PageBreak ======").Create());
            myDoc.AddEle(Paragraph.With("There is a PAGE BREAK after this line:")
                         .Create());
            myDoc.AddEle(PageBreak.Create());
            myDoc.AddEle(Paragraph.With("There is a PAGE BREAK before this line:")
                         .Create());

            myDoc.Save(@"c:\mytest.doc");
        }