Пример #1
0
 internal void copyFrom(RtfCharFormat src)
 {
     if (src == null)
     {
         return;
     }
     _begin = src._begin;
     _end   = src._end;
     if (_font == null && src._font != null)
     {
         _font = new FontDescriptor(src._font.Value);
     }
     if (_ansiFont == null && src._ansiFont != null)
     {
         _ansiFont = new FontDescriptor(src._ansiFont.Value);
     }
     if (_fontSize < 0 && src._fontSize >= 0)
     {
         _fontSize = src._fontSize;
     }
     if (_fontStyle.IsEmpty && !src._fontStyle.IsEmpty)
     {
         _fontStyle = new FontStyle(src._fontStyle);
     }
     if (_bgColor == null && src._bgColor != null)
     {
         _bgColor = new ColorDescriptor(src._bgColor.Value);
     }
     if (_fgColor == null && src._fgColor != null)
     {
         _fgColor = new ColorDescriptor(src._fgColor.Value);
     }
 }
 public void setBorderColor(ColorDescriptor color)
 {
     this.Borders[Direction.Top].Color    = color;
     this.Borders[Direction.Bottom].Color = color;
     this.Borders[Direction.Left].Color   = color;
     this.Borders[Direction.Right].Color  = color;
 }
 public void setHeaderBorderColors(ColorDescriptor colorOuter, ColorDescriptor colorInner)
 {
     for (int j = 0; j < _colCount; j++)
     {
         _cells[0][j].Borders[Direction.Top].Color    = colorOuter;
         _cells[0][j].Borders[Direction.Bottom].Color = colorInner;
         if (j == 0)
         {
             // The first column
             _cells[0][j].Borders[Direction.Right].Color = colorInner;
             _cells[0][j].Borders[Direction.Left].Color  = colorOuter;
         }
         else if (j == _colCount - 1)
         {
             // The last column
             _cells[0][j].Borders[Direction.Right].Color = colorOuter;
             _cells[0][j].Borders[Direction.Left].Color  = colorInner;
         }
         else
         {
             _cells[0][j].Borders[Direction.Right].Color = colorInner;
             _cells[0][j].Borders[Direction.Left].Color  = colorInner;
         }
     }
 }
 /// <summary>
 /// Sets ALL inner borders as specified
 /// </summary>
 /// <param name="style"></param>
 /// <param name="width"></param>
 /// <param name="color"></param>
 public void setInnerBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (int i = 0; i < _rowCount; i++)
     {
         for (int j = 0; j < _colCount; j++)
         {
             if (i == 0)
             {
                 // The first row
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
             }
             else if (i == _rowCount - 1)
             {
                 // The last row
                 _cells[i][j].Borders[Direction.Top].Style = style;
                 _cells[i][j].Borders[Direction.Top].Width = width;
                 _cells[i][j].Borders[Direction.Top].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Top].Style    = style;
                 _cells[i][j].Borders[Direction.Top].Width    = width;
                 _cells[i][j].Borders[Direction.Top].Color    = color;
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
             }
             if (j == 0)
             {
                 // The first column
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
             }
             else if (j == _colCount - 1)
             {
                 // The last column
                 _cells[i][j].Borders[Direction.Left].Style = style;
                 _cells[i][j].Borders[Direction.Left].Width = width;
                 _cells[i][j].Borders[Direction.Left].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
                 _cells[i][j].Borders[Direction.Left].Style  = style;
                 _cells[i][j].Borders[Direction.Left].Width  = width;
                 _cells[i][j].Borders[Direction.Left].Color  = color;
             }
         }
     }
 }
Пример #5
0
 internal RtfCharFormat(int begin, int end, int textLength)
 {
     // Note:
     // In the condition that ``_begin == _end == -1'',
     // the character formatting is applied to the whole paragraph.
     _begin         = -1;
     _end           = -1;
     _font          = null; // do not specify font (use default one)
     _ansiFont      = null; // do not specify font (use default one)
     _fontSize      = -1;   // do not specify font size (use default one)
     _fontStyle     = new FontStyle();
     _bgColor       = null;
     _fgColor       = null;
     _twoInOneStyle = TwoInOneStyle.NotEnabled;
     _bookmark      = "";
     setRange(begin, end, textLength);
 }
 /// <summary>
 /// Sets ALL outer borders as specified
 /// </summary>
 /// <param name="style"></param>
 /// <param name="width"></param>
 /// <param name="color"></param>
 public void setOuterBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (int i = 0; i < _colCount; i++)
     {
         _cells[0][i].Borders[Direction.Top].Style = style;
         _cells[0][i].Borders[Direction.Top].Width = width;
         _cells[0][i].Borders[Direction.Top].Color = color;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Style = style;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Width = width;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Color = color;
     }
     for (int i = 0; i < _rowCount; i++)
     {
         _cells[i][0].Borders[Direction.Left].Style = style;
         _cells[i][0].Borders[Direction.Left].Width = width;
         _cells[i][0].Borders[Direction.Left].Color = color;
         _cells[i][_colCount - 1].Borders[Direction.Right].Style = style;
         _cells[i][_colCount - 1].Borders[Direction.Right].Width = width;
         _cells[i][_colCount - 1].Borders[Direction.Right].Color = color;
     }
 }
 /// <summary>
 /// Internal use only.
 /// Default constructor that sets border style to None.
 /// </summary>
 internal Border()
 {
     _style     = BorderStyle.None;
     _width     = 0.5F;
     _colorDesc = new ColorDescriptor(0);
 }