Esempio n. 1
0
        internal static WorksheetRangeStyle GetRangeStyleObject(object p)
        {
            if (p is WorksheetRangeStyle)
            {
                return((WorksheetRangeStyle)p);
            }
            else if (p is ObjectValue)
            {
                var obj = (ObjectValue)p;

                WorksheetRangeStyle style = new WorksheetRangeStyle();

                SolidColor color;

                object backColor = obj["backgroundColor"];
                if (TextFormatHelper.DecodeColor(ScriptRunningMachine.ConvertToString(backColor), out color))
                {
                    style.Flag     |= PlainStyleFlag.BackColor;
                    style.BackColor = color;
                }

                return(style);
            }
            else
            {
                return(null);
            }
        }
        protected override List <NativeItemData> BuildNativeControlItems()
        {
            var newListData = new List <NativeItemData>(Items.Count);

            if (Items != null)
            {
                var hdcMem = OffScreenGraphics.GetHdc();

                try
                {
                    using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty))
                    {
                        g.Font      = Settings.SecondaryTextFontGdi;
                        g.TextAlign = Win32.TextAlign.TA_LEFT;

                        for (int i = 0; i < Items.Count; i++)
                        {
                            string photo = string.Empty;

                            if (Items[i].IsPhotoLoaded)
                            {
                                photo = Items[i].Photo;
                            }
                            else
                            {
                                photo = "clear";
                            }

                            NativeItemData newNativeItemData = new KineticListView <PhotoCommentsUpdatesViewItem> .NativeItemData
                            {
                                Uid   = Items[i].Uid,
                                Group = Items[i].Group,

                                PrimaryText   = Items[i].SenderName,
                                SecondaryText = Items[i].Comment,
                                TertiaryText  = Items[i].CommentSetDate.ToString("HH:mm"),

                                SecondaryTextLines = TextFormatHelper.CutTextToLines(Items[i].Comment, UISettings.CalcPix(170), 2, g),

                                PrimaryImageURL = photo,

                                InfoLeftIndents = new int[3],
                                InfoTopIndents  = new int[2]
                            };

                            newListData.Add(newNativeItemData);
                        }
                    }
                }
                finally
                {
                    OffScreenGraphics.ReleaseHdc(hdcMem);
                }
            }

            return(newListData);
        }
        private void SetStartPositions(List <NativeItemData> nid)
        {
            int c = 0;

            StartPositions.Clear();

            if (ItemCount == 0)
            {
                _ActiveListHeight = 0;
                _ActiveListWidth  = 0;
                return;
            }

            var hdcMem = OffScreenGraphics.GetHdc();

            try
            {
                using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty))
                {
                    g.Font      = Settings.SecondaryTextFontGdi;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;

                    for (int i = 0; i < ItemCount; i++)
                    {
                        StartPositions.Add(c);

                        //nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(40), 0, g);
                        nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(29), Settings.SecondaryTextLinesCount, g);

                        //SecondaryTextLinesCount

                        c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11));

                        if (ShowGroupHeader)
                        {
                            //if (IsItemNewGroup(nItem) && item.Group != null && rItem.Top >= rListRect.Top)
                            if (IsItemNewGroup(i) && nid[i].Group != null)
                            {
                                c += Settings.GroupPixHeight;
                            }
                        }

                        //c += Settings.ListItemPixSize;
                    }
                }
            }
            finally
            {
                OffScreenGraphics.ReleaseHdc(hdcMem);
            }

            StartPositions.Add(c); //The end of tha last item

            _ActiveListHeight = c;

            ScrollTo(0);
        }
        protected override List <NativeItemData> BuildNativeControlItems()
        {
            var newListData = new List <NativeItemData>(Items.Count);

            if (Items != null)
            {
                for (int i = 0; i < Items.Count; i++)
                {
                    List <string> secondaryTextLines = new List <string>();

                    var hdcMem = OffScreenGraphics.GetHdc();

                    try
                    {
                        using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty))
                        {
                            g.Font      = Settings.SecondaryTextFontGdi;
                            g.TextAlign = Win32.TextAlign.TA_LEFT;

                            secondaryTextLines = TextFormatHelper.CutTextToLines(Items[i].MessageText, UISettings.CalcPix(192), 2, g);
                        }
                    }
                    finally
                    {
                        OffScreenGraphics.ReleaseHdc(hdcMem);
                    }

                    NativeItemDataNew newNativeItemData = new NativeItemDataNew
                    {
                        Uid = Items[i].Uid,

                        PrimaryText   = Items[i].UserName,
                        SecondaryText = Items[i].MessageText,
                        TertiaryText  = Items[i].MessageWroteDateString,

                        SecondaryTextLines = secondaryTextLines,

                        IsItemHighlight = Items[i].IsMessageNew,
                        IsOutboxIconSet = Items[i].IsMessageOutbox,

                        Tag          = Items[i].UserID,
                        PrimaryImage = null,//MasterForm.SkinManager.GetImage("IsOutputMessage"),

                        InfoLeftIndents = new int[5],
                        InfoTopIndents  = new int[3]
                    };

                    newListData.Add(newNativeItemData);
                }
            }

            return(newListData);
        }
Esempio n. 5
0
        private void DrawDescription(int initialY, IDescriptionProvider descriptionProvider)
        {
            const int initialX         = 1;
            var       descriptionLines = TextFormatHelper.SplitText(descriptionProvider.GetDescription(player),
                                                                    Width - initialX - 1, BackColor);

            for (int yShift = 0; yShift < descriptionLines.Length; yShift++)
            {
                var line = descriptionLines[yShift];
                var y    = initialY + yShift;
                Surface.Print(initialX, y, line);
            }
        }
Esempio n. 6
0
            internal RGXmlBorder(int row, int col, RangeBorderStyle borderStyle, string pos)
            {
                this.row = row;
                this.col = col;
                this.pos = pos;

                if (borderStyle.Color != SolidColor.Black)
                {
                    color = TextFormatHelper.EncodeColor(borderStyle.Color);
                }
                if (borderStyle.Style != BorderLineStyle.Solid)
                {
                    style = borderStyle.Style.ToString();
                }
            }
Esempio n. 7
0
        private List <ScheduleItem> ParseInput(List <string> lines)
        {
            List <ScheduleItem> requests = new List <ScheduleItem>();

            if (lines.Count <= 0)
            {
                return(requests);
            }
            else
            {
                foreach (string line in lines)
                {
                    ScheduleItem schedule = new ScheduleItem();
                    string[]     words    = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    if (words.Length == 1)
                    {
                        // ignore bad input
                        schedule.ScheduleTime = TextFormatHelper.ConvertTimeStrToNum(words[0]);
                        if (schedule.ScheduleTime < 0)
                        {
                            continue;
                        }
                    }
                    else if (words.Length > 1)
                    {
                        // ignore bad input
                        schedule.ScheduleTime = TextFormatHelper.ConvertTimeStrToNum(words[words.Length - 1]);
                        if (schedule.ScheduleTime < 0)
                        {
                            continue;
                        }
                        else
                        {
                            schedule.ScheduleName = string.Join(" ", words, 0, words.Length - 1);
                        }
                    }
                    else
                    {
                        break;
                    }

                    requests.Add(schedule);
                }
            }

            return(requests);
        }
Esempio n. 8
0
        private void SetStartPositions(List <NativeItemData> nid)
        {
            int c = 0;

            StartPositions.Clear();

            if (ItemCount == 0)
            {
                _ActiveListHeight = 0;

                return;
            }

            var hdcMem     = OffScreenGraphics.GetHdc();
            int lastHeight = 0;

            try
            {
                using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty))
                {
                    g.Font      = Settings.SecondaryTextFontGdi;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;

                    // для текста в каждой ячейке
                    for (int i = 0; i < ItemCount; i++)
                    {
                        StartPositions.Add(c);

                        nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, UISettings.CalcPix(200), 0, g);

                        c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11));
                    }

                    StartPositions.Add(c);
                }
            }
            finally
            {
                OffScreenGraphics.ReleaseHdc(hdcMem);
            }



            _ActiveListHeight = c;
        }
Esempio n. 9
0
        public RSCellStyleObject(Worksheet sheet, Cell cell)
        {
            this.sheet = sheet;
            this.Cell  = cell;

            this["backgroundColor"] = new ExternalProperty(
                () => TextFormatHelper.EncodeColor(cell.InnerStyle.BackColor),
                (v) =>
            {
                SolidColor color;

                if (TextFormatHelper.DecodeColor(ScriptRunningMachine.ConvertToString(v), out color))
                {
                    this.sheet.SetCellStyleOwn(cell.InternalPos, new WorksheetRangeStyle
                    {
                        Flag      = PlainStyleFlag.BackColor,
                        BackColor = color,
                    });

                    this.sheet.RequestInvalidate();
                }
            });

            this["color"] = new ExternalProperty(
                () => TextFormatHelper.EncodeColor(cell.InnerStyle.TextColor),
                (v) =>
            {
                SolidColor color;

                if (TextFormatHelper.DecodeColor(ScriptRunningMachine.ConvertToString(v), out color))
                {
                    this.sheet.SetCellStyleOwn(cell.InternalPos, new WorksheetRangeStyle
                    {
                        Flag      = PlainStyleFlag.TextColor,
                        TextColor = color,
                    });

                    this.sheet.RequestInvalidate();
                }
            });

            this["fontName"] = new ExternalProperty(() => cell.Style.FontName,
                                                    (v) => cell.Style.FontName = ScriptRunningMachine.ConvertToString(v));

            this["fontSize"] = new ExternalProperty(
                () => cell.Style.FontSize,
                (v) => cell.Style.FontSize = TextFormatHelper.GetFloatPixelValue(ScriptRunningMachine.ConvertToString(v),
                                                                                 System.Drawing.SystemFonts.DefaultFont.Size));

            this["align"] = new ExternalProperty(
                () => cell.Style.HAlign,
                (v) =>
            {
                this.sheet.SetCellStyleOwn(cell.InternalPos, new WorksheetRangeStyle
                {
                    Flag   = PlainStyleFlag.HorizontalAlign,
                    HAlign = XmlFileFormatHelper.DecodeHorizontalAlign(ScriptRunningMachine.ConvertToString(v)),
                });

                this.sheet.RequestInvalidate();
            });

            this["valign"] = new ExternalProperty(
                () => cell.Style.VAlign,
                (v) =>
            {
                this.sheet.SetCellStyleOwn(cell.InternalPos, new WorksheetRangeStyle
                {
                    Flag   = PlainStyleFlag.VerticalAlign,
                    VAlign = XmlFileFormatHelper.DecodeVerticalAlign(ScriptRunningMachine.ConvertToString(v)),
                });

                this.sheet.RequestInvalidate();
            });
        }
Esempio n. 10
0
        private void SetStartPositions(List <NativeItemData> nid)
        {
            int c = 0;

            StartPositions.Clear();

            if (ItemCount == 0)
            {
                _ActiveListHeight = 0;

                return;
            }

            var hdcMem = OffScreenGraphics.GetHdc();

            try
            {
                using (Gdi g = Gdi.FromHdc(hdcMem, Rectangle.Empty))
                {
                    g.Font      = Settings.SecondaryTextFontGdi;
                    g.TextAlign = Win32.TextAlign.TA_LEFT;

                    // для текста в каждой ячейке
                    for (int i = 0; i < ItemCount; i++)
                    {
                        StartPositions.Add(c);

                        // есть заголовок группы?
                        if (IsItemNewGroup(i) && !string.IsNullOrEmpty(nid[i].Group))
                        {
                            c += Settings.GroupPixHeight;
                        }

                        // что выводим?
                        switch (Items[i].Type)
                        {
                        case ImageDetailedListViewItemType.Author:     // ячейка "автор"
                            c += UISettings.CalcPix(25);
                            break;

                        case ImageDetailedListViewItemType.Comment:     // ячейка "комментарий"
                            nid[i].SecondaryTextLines = TextFormatHelper.CutTextToLines(nid[i].SecondaryText, Width - UISettings.CalcPix(10), 0, g);
                            c += (Settings.ListItemPixSize + (nid[i].SecondaryTextLines.Count + 1) * UISettings.CalcPix(11));
                            break;

                        case ImageDetailedListViewItemType.Photo:
                            if (Items[i].IsPhotoLoaded)
                            {
                                c += Items[i].PhotoHeight;
                            }
                            else
                            {
                                c += UISettings.CalcPix(50);
                            }
                            break;
                        }
                    }
                }
            }
            finally
            {
                OffScreenGraphics.ReleaseHdc(hdcMem);
            }

            StartPositions.Add(c);

            _ActiveListHeight = c;

            ScrollTo(0);
        }
Esempio n. 11
0
        /// <summary>
        /// Export grid as html5 into specified stream
        /// </summary>
        /// <param name="s">Stream contains the exported HTML5 content</param>
        /// <param name="sheet">Instance of worksheet</param>
        /// <param name="pageTitle">Custom page title of HTML page</param>
        /// <param name="htmlHeader">True to export default HTML header tag; false to export table content only</param>
        public static void Export(Stream s, Worksheet sheet, string pageTitle, bool htmlHeader = true)
        {
            using (StreamWriter sw = new StreamWriter(s))
            {
                StringBuilder sb = new StringBuilder();
                Cell          cell;

                if (htmlHeader)
                {
                    sw.WriteLine("<!DOCTYPE html>");
                    sw.WriteLine("<html>");
                    sw.WriteLine("<head>");
                    sw.WriteLine("  <title>{0}</title>", pageTitle);
                    sw.WriteLine("  <meta content=\"text/html; charset=UTF-8\">");
                    sw.WriteLine("</head>");
                    sw.WriteLine("<body>");
                }

                sw.WriteLine("  <table style='border-collapse:collapse;border:none;'>");

                int maxRow = sheet.MaxContentRow;
                int maxCol = sheet.MaxContentCol;

                for (int r = 0; r <= maxRow; r++)
                {
                    var row = sheet.RetrieveRowHeader(r);

                    sw.WriteLine(string.Format("    <tr style='height:{0}px;'>", row.InnerHeight));

                    for (int c = 0; c <= maxCol;)
                    {
                        var col = sheet.RetrieveColumnHeader(c);

                        cell = sheet.GetCell(r, c);

                        if (cell != null && (cell.Colspan <= 0 || cell.Rowspan <= 0))
                        {
                            c++;
                            continue;
                        }

                        sb.Length = 0;
                        sb.Append("      <td");

                        if (cell != null && cell.Rowspan > 1)
                        {
                            sb.Append(" rowspan='" + cell.Rowspan + "'");
                        }
                        if (cell != null && cell.Colspan > 1)
                        {
                            sb.Append(" colspan='" + cell.Colspan + "'");
                        }

                        sb.AppendFormat(" style='width:{0}px;", cell == null ? col.Width : cell.Width);

                        bool halignOutputted = false;

                        if (cell != null)
                        {
                            // render horizontal align
                            if (cell.RenderHorAlign == ReoGridRenderHorAlign.Right)
                            {
                                WriteHtmlStyle(sb, "text-align", "right");
                                halignOutputted = true;
                            }
                            else if (cell.RenderHorAlign == ReoGridRenderHorAlign.Center)
                            {
                                WriteHtmlStyle(sb, "text-align", "center");
                                halignOutputted = true;
                            }
                        }

                        WorksheetRangeStyle style = sheet.GetCellStyles(r, c);
                        if (style != null)
                        {
                            // back color
                            if (style.HasStyle(PlainStyleFlag.BackColor) && style.BackColor != SolidColor.White)
                            {
                                WriteHtmlStyle(sb, "background-color", TextFormatHelper.EncodeColor(style.BackColor));
                            }

                            // text color
                            if (style.HasStyle(PlainStyleFlag.TextColor) && style.TextColor != SolidColor.Black)
                            {
                                WriteHtmlStyle(sb, "color", TextFormatHelper.EncodeColor(style.TextColor));
                            }

                            // font size
                            if (style.HasStyle(PlainStyleFlag.FontSize))
                            {
                                WriteHtmlStyle(sb, "font-size", style.FontSize.ToString() + "pt");
                            }

                            // horizontal align
                            if (!halignOutputted && style.HasStyle(PlainStyleFlag.HorizontalAlign))
                            {
                                WriteHtmlStyle(sb, "text-align", XmlFileFormatHelper.EncodeHorizontalAlign(style.HAlign));
                            }

                            // vertical align
                            if (style.HasStyle(PlainStyleFlag.VerticalAlign))
                            {
                                WriteHtmlStyle(sb, "vertical-align", XmlFileFormatHelper.EncodeVerticalAlign(style.VAlign));
                            }
                        }

                        RangeBorderInfoSet rbi = sheet.GetRangeBorders(cell == null ? new RangePosition(r, c, 1, 1)
                                                        : new RangePosition(cell.InternalRow, cell.InternalCol, cell.Rowspan, cell.Colspan));

                        if (!rbi.Top.IsEmpty)
                        {
                            WriteCellBorder(sb, "border-top", rbi.Top);
                        }
                        if (!rbi.Left.IsEmpty)
                        {
                            WriteCellBorder(sb, "border-left", rbi.Left);
                        }
                        if (!rbi.Right.IsEmpty)
                        {
                            WriteCellBorder(sb, "border-right", rbi.Right);
                        }
                        if (!rbi.Bottom.IsEmpty)
                        {
                            WriteCellBorder(sb, "border-bottom", rbi.Bottom);
                        }

                        sb.Append("'>");

                        sw.WriteLine(sb.ToString());

                        //cell = Grid.GetCell(r, c);

                        string text = null;
                        if (cell != null)
                        {
                            text = string.IsNullOrEmpty(cell.DisplayText) ? "&nbsp;" :
#if !CLIENT_PROFILE
                                   HtmlEncode(cell.DisplayText)
#else
                                   cell.DisplayText
#endif // CLIENT_PROFILE
                            ;
                        }
                        else
                        {
                            text = "&nbsp;";
                        }

                        sw.WriteLine(text);

                        sw.WriteLine("      </td>");

                        c += cell == null ? 1 : cell.Colspan;
                    }
                    sw.WriteLine("    </tr>");
                }
                sw.WriteLine("  </table>");

                if (htmlHeader)
                {
                    sw.WriteLine("</body>");
                    sw.WriteLine("</html>");
                }
            }
        }
Esempio n. 12
0
 private static void WriteCellBorder(StringBuilder sb, string name, RangeBorderStyle borderStyle)
 {
     WriteHtmlStyle(sb, name, string.Format("{0} {1}",
                                            ToHTMLBorderLineStyle(borderStyle.Style), TextFormatHelper.EncodeColor(borderStyle.Color)));
 }
Esempio n. 13
0
        internal static WorksheetRangeStyle ConvertFromXmlStyle(Worksheet grid, RGXmlCellStyle xmlStyle,
                                                                CultureInfo culture)
        {
            WorksheetRangeStyle style = new WorksheetRangeStyle();

            if (xmlStyle == null)
            {
                return(style);
            }

            // back color
            if (!string.IsNullOrEmpty(xmlStyle.backColor))
            {
                SolidColor color;

                if (TextFormatHelper.DecodeColor(xmlStyle.backColor, out color))
                {
                    style.Flag     |= PlainStyleFlag.BackColor;
                    style.BackColor = color;
                }
            }

            // fill pattern
            if (xmlStyle.fillPattern != null)
            {
                SolidColor color;
                if (TextFormatHelper.DecodeColor(xmlStyle.fillPattern.color, out color))
                {
                    style.Flag            |= PlainStyleFlag.FillPattern;
                    style.FillPatternColor = color;
                    style.FillPatternStyle = (HatchStyles)xmlStyle.fillPattern.patternStyleId;
                }
            }

            // text color
            if (!string.IsNullOrEmpty(xmlStyle.textColor))
            {
                SolidColor color;
                if (TextFormatHelper.DecodeColor(xmlStyle.textColor, out color))
                {
                    style.Flag     |= PlainStyleFlag.TextColor;
                    style.TextColor = color;
                }
            }

            // horizontal align
            if (!string.IsNullOrEmpty(xmlStyle.hAlign))
            {
                style.Flag  |= PlainStyleFlag.HorizontalAlign;
                style.HAlign = XmlFileFormatHelper.DecodeHorizontalAlign(xmlStyle.hAlign);
            }
            // vertical align
            if (!string.IsNullOrEmpty(xmlStyle.vAlign))
            {
                style.Flag  |= PlainStyleFlag.VerticalAlign;
                style.VAlign = XmlFileFormatHelper.DecodeVerticalAlign(xmlStyle.vAlign);
            }

            // font name
            if (!string.IsNullOrEmpty(xmlStyle.font))
            {
                style.Flag    |= PlainStyleFlag.FontName;
                style.FontName = xmlStyle.font;
            }
            // font size
            if (xmlStyle.fontSize != null)
            {
                style.Flag    |= PlainStyleFlag.FontSize;
                style.FontSize = TextFormatHelper.GetFloatValue(xmlStyle.fontSize, grid.RootStyle.FontSize, culture);
            }

            // bold
            if (xmlStyle.bold != null)
            {
                style.Flag |= PlainStyleFlag.FontStyleBold;
                style.Bold  = xmlStyle.bold == "true";
            }
            // italic
            if (xmlStyle.italic != null)
            {
                style.Flag  |= PlainStyleFlag.FontStyleItalic;
                style.Italic = xmlStyle.italic == "true";
            }
            // strikethrough
            if (xmlStyle.strikethrough != null)
            {
                style.Flag         |= PlainStyleFlag.FontStyleStrikethrough;
                style.Strikethrough = xmlStyle.strikethrough == "true";
            }
            // underline
            if (xmlStyle.underline != null)
            {
                style.Flag     |= PlainStyleFlag.FontStyleUnderline;
                style.Underline = xmlStyle.underline == "true";
            }

            // text-wrap
            if (!string.IsNullOrEmpty(xmlStyle.textWrap))
            {
                style.Flag        |= PlainStyleFlag.TextWrap;
                style.TextWrapMode = XmlFileFormatHelper.DecodeTextWrapMode(xmlStyle.textWrap);
            }

            // padding
            if (!string.IsNullOrEmpty(xmlStyle.indent))
            {
                style.Flag |= PlainStyleFlag.Indent;

                int indent = TextFormatHelper.GetPixelValue(xmlStyle.indent, 0);
                if (indent > 0 && indent < 65535)
                {
                    style.Indent = (ushort)indent;
                }
            }

            // padding
            if (!string.IsNullOrEmpty(xmlStyle.padding))
            {
                style.Flag   |= PlainStyleFlag.Padding;
                style.Padding = TextFormatHelper.DecodePadding(xmlStyle.padding);
            }

            // rotate angle
            int angle;

            if (!string.IsNullOrEmpty(xmlStyle.rotateAngle) &&
                int.TryParse(xmlStyle.rotateAngle, out angle))
            {
                style.Flag         |= PlainStyleFlag.RotationAngle;
                style.RotationAngle = angle;
            }

            return(style);
        }
Esempio n. 14
0
        internal static RGXmlCellStyle ConvertToXmlStyle(WorksheetRangeStyle style)
        {
            if (style == null || style.Flag == PlainStyleFlag.None)
            {
                return(null);
            }

            RGXmlCellStyle xmlStyle = new RGXmlCellStyle();

            if (StyleUtility.HasStyle(style, PlainStyleFlag.BackColor))
            {
                xmlStyle.backColor = TextFormatHelper.EncodeColor(style.BackColor);
            }

            if (HasStyle(style, PlainStyleFlag.FillPattern))
            {
                RGXmlCellStyleFillPattern xmlFillPattern = new RGXmlCellStyleFillPattern()
                {
                    color          = TextFormatHelper.EncodeColor(style.FillPatternColor),
                    patternStyleId = (int)style.FillPatternStyle,
                };
                xmlStyle.fillPattern = xmlFillPattern;
            }

            if (StyleUtility.HasStyle(style, PlainStyleFlag.TextColor))
            {
                xmlStyle.textColor = TextFormatHelper.EncodeColor(style.TextColor);
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontName))
            {
                xmlStyle.font = style.FontName;
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontSize))
            {
                xmlStyle.fontSize = style.FontSize.ToString();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontStyleBold))
            {
                xmlStyle.bold = style.Bold.ToString().ToLower();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontStyleItalic))
            {
                xmlStyle.italic = style.Italic.ToString().ToLower();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontStyleStrikethrough))
            {
                xmlStyle.strikethrough = style.Strikethrough.ToString().ToLower();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.FontStyleUnderline))
            {
                xmlStyle.underline = style.Underline.ToString().ToLower();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.HorizontalAlign))
            {
                xmlStyle.hAlign = XmlFileFormatHelper.EncodeHorizontalAlign(style.HAlign);
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.VerticalAlign))
            {
                xmlStyle.vAlign = XmlFileFormatHelper.EncodeVerticalAlign(style.VAlign);
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.TextWrap))
            {
                xmlStyle.textWrap = XmlFileFormatHelper.EncodeTextWrapMode(style.TextWrapMode);
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.Indent))
            {
                xmlStyle.indent = style.Indent.ToString();
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.Padding))
            {
                xmlStyle.padding = TextFormatHelper.EncodePadding(style.Padding);
            }
            if (StyleUtility.HasStyle(style, PlainStyleFlag.RotationAngle))
            {
                xmlStyle.rotateAngle = style.RotationAngle.ToString();
            }

            return(xmlStyle);
        }
Esempio n. 15
0
        private ColoredString[] SpreadMessage(JournalMessageData message, int width)
        {
            var formattedMessage = messageFormatter.FormatMessage(message);

            return(TextFormatHelper.SplitText(formattedMessage, width));
        }