Ejemplo n.º 1
0
 public Boolean Equals(IXLRichString other)
 {
     return
         (Text == other.Text &&
          Bold.Equals(other.Bold) &&
          Italic.Equals(other.Italic) &&
          Underline.Equals(other.Underline) &&
          Strikethrough.Equals(other.Strikethrough) &&
          VerticalAlignment.Equals(other.VerticalAlignment) &&
          Shadow.Equals(other.Shadow) &&
          FontSize.Equals(other.FontSize) &&
          FontColor.Equals(other.FontColor) &&
          FontName.Equals(other.FontName) &&
          FontFamilyNumbering.Equals(other.FontFamilyNumbering)
         );
 }
Ejemplo n.º 2
0
 public Boolean Equals(IXLRichString other)
 {
     return
             Text == other.Text
         && Bold.Equals(other.Bold)
         && Italic.Equals(other.Italic)
         && Underline.Equals(other.Underline)
         && Strikethrough.Equals(other.Strikethrough)
         && VerticalAlignment.Equals(other.VerticalAlignment)
         && Shadow.Equals(other.Shadow)
         && FontSize.Equals(other.FontSize)
         && FontColor.Equals(other.FontColor)
         && FontName.Equals(other.FontName)
         && FontFamilyNumbering.Equals(other.FontFamilyNumbering)
         ;
 }
        private static Run GetRun(IXLRichString rt)
        {
            var run = new Run();

            var runProperties = new RunProperties();

            var bold = rt.Bold ? new Bold() : null;
            var italic = rt.Italic ? new Italic() : null;
            var underline = rt.Underline != XLFontUnderlineValues.None
                ? new Underline {Val = rt.Underline.ToOpenXml()}
                : null;
            var strike = rt.Strikethrough ? new Strike() : null;
            var verticalAlignment = new VerticalTextAlignment
            {Val = rt.VerticalAlignment.ToOpenXml()};
            var shadow = rt.Shadow ? new Shadow() : null;
            var fontSize = new FontSize {Val = rt.FontSize};
            var color = GetNewColor(rt.FontColor);
            var fontName = new RunFont {Val = rt.FontName};
            var fontFamilyNumbering = new FontFamily {Val = (Int32)rt.FontFamilyNumbering};

            if (bold != null) runProperties.Append(bold);
            if (italic != null) runProperties.Append(italic);

            if (strike != null) runProperties.Append(strike);
            if (shadow != null) runProperties.Append(shadow);
            if (underline != null) runProperties.Append(underline);
            runProperties.Append(verticalAlignment);

            runProperties.Append(fontSize);
            runProperties.Append(color);
            runProperties.Append(fontName);
            runProperties.Append(fontFamilyNumbering);

            var text = new Text {Text = rt.Text};
            if (rt.Text.PreserveSpaces())
                text.Space = SpaceProcessingModeValues.Preserve;

            run.Append(runProperties);
            run.Append(text);
            return run;
        }
Ejemplo n.º 4
0
 public IXLRichString AddText(IXLRichString richText)
 {
     _richTexts.Add(richText);
     Length += richText.Text.Length;
     return(richText);
 }