protected override void Write(string weaponnames, Info weapon)
        {
            RtfParagraph  paragraphWeaponName = _document.addParagraph();
            RtfCharFormat formatWeaponName    = paragraphWeaponName.addCharFormat();

            formatWeaponName.FontStyle.addStyle(FontStyleFlag.Bold);
            paragraphWeaponName.Text.Append(weaponnames);

            RtfParagraph  paragraph = _document.addParagraph();
            RtfCharFormat format    = paragraph.addCharFormat();

            paragraph.Text.AppendLine(weapon.info);

            if (weapon.additionalFields == null)
            {
                return;
            }

            foreach (KeyValuePair <string, string> pair in weapon.additionalFields)
            {
                paragraph.Text.Append(pair.Key);
                paragraph.Text.Append(": ");
                paragraph.Text.Append(pair.Value);
                paragraph.Text.AppendLine();
            }
        }
Пример #2
0
        private static RtfCharFormat addParagraphChunk(RtfParagraph par, string text, IFont font)
        {
            FontStruct fntStr = ((FontHandler)font).Handle;

            par.DefaultCharFormat.Font = fntStr.FD;

            int beg = par.Text.Length;

            par.Text.Append(text);
            int end = par.Text.Length - 1;

            RtfCharFormat fmt = par.addCharFormat(beg, end);

            fmt.Font     = fntStr.FD;
            fmt.FgColor  = fntStr.Color;
            fmt.FontSize = fntStr.Size;
            if (fntStr.Bold)
            {
                fmt.FontStyle.addStyle(FontStyleFlag.Bold);
            }
            if (fntStr.Underline)
            {
                fmt.FontStyle.addStyle(FontStyleFlag.Underline);
            }

            return(fmt);
        }
        protected override void WriteSlot(string text)
        {
            RtfParagraph  paragraph = _document.addParagraph();
            RtfCharFormat format    = paragraph.addCharFormat();

            format.FontStyle.addStyle(FontStyleFlag.Italic);
            paragraph.Text.AppendLine(text);
        }
        protected override void WriteClass(string text)
        {
            RtfParagraph  paragraph = _document.addParagraph();
            RtfCharFormat format    = paragraph.addCharFormat();

            format.FontStyle.addStyle(FontStyleFlag.Bold | FontStyleFlag.Underline);
            paragraph.Text.AppendLine(text);
        }
Пример #5
0
        public void BuildTokenListTest()
        {
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText("Test Token Method");
            rtfParagraph.addCharFormat(-1, -1);
            Assert.DoesNotThrow(() => rtfParagraph.render());
        }
Пример #6
0
        public void GenerateExceptionWhenEnd_GreaterThanOrEqualTo_TextLength()
        {
            var text         = "Test Token Method";
            int end          = text.Length;
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText(text);
            Assert.Throws <Exception>(() => rtfParagraph.addCharFormat(0, text.Length));
        }
Пример #7
0
        public void BuildTokenListTestForTotalParagraph()
        {
            var text         = "Test Token Method";
            var rtfParagraph = new RtfParagraph(true, true, ReadingDirection.LeftToRight);

            rtfParagraph.setText(text);
            rtfParagraph.addCharFormat(0, text.Length - 1);
            Assert.DoesNotThrow(() => rtfParagraph.render());
        }
Пример #8
0
        public void AddCharFormatForParagraphWithoutBeginandEnd()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.setText(text);
            var charFormat = rtfParagraph.addCharFormat();

            Assert.AreEqual(text.Length, rtfParagraph.Text.Length);
            Assert.IsNotNull(charFormat);
        }
        protected override void Write(RebalanceInfo weapon)
        {
            RtfParagraph  paragraphWeaponName = _document.addParagraph();
            RtfCharFormat formatWeaponName    = paragraphWeaponName.addCharFormat();

            formatWeaponName.FontStyle.addStyle(FontStyleFlag.Bold);
            paragraphWeaponName.Text.AppendLine(weapon.name);

            RtfParagraph  paragraph = _document.addParagraph();
            RtfCharFormat format    = paragraph.addCharFormat();

            paragraph.Text.AppendLine(weapon.info);
            paragraph.Text.AppendLine();
        }
Пример #10
0
        public void AddCharFormatForParagraph()
        {
            var text         = "Test Paragraph";
            var rtfParagraph = new RtfParagraph(true, true);

            rtfParagraph.LineSpacing     = 2;
            rtfParagraph.FirstLineIndent = 2;
            rtfParagraph.StartNewPage    = false;
            rtfParagraph.setText(text);
            var charFormat = rtfParagraph.addCharFormat(1, 6);

            Assert.AreEqual(text.Length, rtfParagraph.Text.Length);
            Assert.IsNotNull(charFormat);
        }
Пример #11
0
        private static void AddParagraphChunk(RtfParagraph par, string text, FontStruct fntStr)
        {
            par.DefaultCharFormat.Font = fntStr.FD;

            int beg = par.Text.Length;

            par.Text.Append(text);
            int end = par.Text.Length - 1;

            RtfCharFormat fmt = par.addCharFormat(beg, end);

            fmt.Font     = fntStr.FD;
            fmt.FgColor  = fntStr.Color;
            fmt.FontSize = fntStr.Size;
            if (fntStr.Bold)
            {
                fmt.FontStyle.addStyle(FontStyleFlag.Bold);
            }
            if (fntStr.Underline)
            {
                fmt.FontStyle.addStyle(FontStyleFlag.Underline);
            }
        }