/// <summary>
        /// Renders the cell's shading, borders and so on (used by the RowRenderer).
        /// </summary>
        internal override void Render()
        {
            useEffectiveValue = true;
            this.coveringCell = this.cellList.GetCoveringCell(this.cell);
            Borders borders = this.cellList.GetEffectiveBorders(this.coveringCell);

            if (this.cell.Column.Index != this.coveringCell.Column.Index)
            {
                return;
            }

            if (borders != null)
            {
                BordersRenderer brdrsRenderer = new BordersRenderer(borders, this.docRenderer);
                brdrsRenderer.leaveAwayLeft   = this.cell.Column.Index != this.coveringCell.Column.Index;
                brdrsRenderer.leaveAwayTop    = this.cell.Row.Index != this.coveringCell.Row.Index;
                brdrsRenderer.leaveAwayBottom = this.cell.Row.Index != this.coveringCell.Row.Index + this.coveringCell.MergeDown;
                brdrsRenderer.leaveAwayRight  = false;
                brdrsRenderer.ParentCell      = this.cell;
                brdrsRenderer.Render();
            }
            if (cell == this.coveringCell)
            {
                RenderLeftRightPadding();
                Translate("VerticalAlignment", "clvertal");
            }
            object obj = this.coveringCell.GetValue("Shading", GV.GetNull);

            if (obj != null)
            {
                new ShadingRenderer((DocumentObject)obj, this.docRenderer).Render();
            }

            //Note that vertical and horizontal merging are not symmetrical.
            //Horizontally merged cells are simply rendered as bigger cells.
            if (this.cell.Row.Index == this.coveringCell.Row.Index && this.coveringCell.MergeDown > 0)
            {
                this.rtfWriter.WriteControl("clvmgf");
            }

            if (this.cell.Row.Index > this.coveringCell.Row.Index)
            {
                this.rtfWriter.WriteControl("clvmrg");
            }

            this.rtfWriter.WriteControl("cellx", GetRightCellBoundary());
        }
Exemple #2
0
        /// <summary>
        ///   Renders the cell's shading, borders and so on (used by the RowRenderer).
        /// </summary>
        internal override void Render()
        {
            _useEffectiveValue = true;
            _coveringCell = _cellList.GetCoveringCell(_cell);
            Borders borders = _cellList.GetEffectiveBorders(_coveringCell);
            if (_cell.Column.Index != _coveringCell.Column.Index)
                return;

            if (borders != null)
            {
                BordersRenderer brdrsRenderer = new BordersRenderer(borders, _docRenderer);
                brdrsRenderer.LeaveAwayLeft = _cell.Column.Index != _coveringCell.Column.Index;
                brdrsRenderer.LeaveAwayTop = _cell.Row.Index != _coveringCell.Row.Index;
                brdrsRenderer.LeaveAwayBottom = _cell.Row.Index != _coveringCell.Row.Index + _coveringCell.MergeDown;
                brdrsRenderer.LeaveAwayRight = false;
                brdrsRenderer.ParentCell = _cell;
                brdrsRenderer.Render();
            }
            if (_cell == _coveringCell)
            {
                RenderLeftRightPadding();
                Translate("VerticalAlignment", "clvertal");
            }
            object obj = _coveringCell.GetValue("Shading", GV.GetNull);
            if (obj != null)
                new ShadingRenderer((DocumentObject)obj, _docRenderer).Render();

            //Note that vertical and horizontal merging are not symmetrical.
            //Horizontally merged cells are simply rendered as bigger cells.
            if (_cell.Row.Index == _coveringCell.Row.Index && _coveringCell.MergeDown > 0)
                _rtfWriter.WriteControl("clvmgf");

            if (_cell.Row.Index > _coveringCell.Row.Index)
                _rtfWriter.WriteControl("clvmrg");

            _rtfWriter.WriteControl("cellx", GetRightCellBoundary());
        }
Exemple #3
0
        /// <summary>
        /// Renders a ParagraphFormat object.
        /// </summary>
        internal override void Render()
        {
            _useEffectiveValue = true; //unfortunately has to be true always.

            Translate("Alignment", "q");
            Translate("SpaceBefore", "sb");
            Translate("SpaceAfter", "sa");

            TranslateBool("WidowControl", "widctlpar", "nowidctlpar", false);
            Translate("PageBreakBefore", "pagebb");
            Translate("KeepTogether", "keep");
            Translate("KeepWithNext", "keepn");
            Translate("FirstLineIndent", "fi");

            Translate("LeftIndent", "li");
            Translate("LeftIndent", "lin");

            Translate("RightIndent", "ri");
            Translate("RightIndent", "rin");

            object ol = GetValueAsIntended("OutlineLevel");

            if (ol != null && ((OutlineLevel)ol) != OutlineLevel.BodyText)
            {
                Translate("OutlineLevel", "outlinelevel");
            }

            Unit            lineSpc     = (Unit)GetValueAsIntended("LineSpacing");
            LineSpacingRule lineSpcRule = (LineSpacingRule)GetValueAsIntended("LineSpacingRule");

            switch (lineSpcRule)
            {
            case LineSpacingRule.Exactly:     // A bit strange, but follows the RTF specification:
                _rtfWriter.WriteControl("sl", ToTwips(-lineSpc.Point));
                break;

            case LineSpacingRule.AtLeast:
                Translate("LineSpacing", "sl");
                break;

            case LineSpacingRule.Multiple:
                _rtfWriter.WriteControl("sl", ToRtfUnit(lineSpc, RtfUnit.Lines));
                break;

            case LineSpacingRule.Double:
                _rtfWriter.WriteControl("sl", 480);     // equals 12 * 2 * 20 (Standard line height * 2  in twips)
                break;

            case LineSpacingRule.OnePtFive:
                _rtfWriter.WriteControl("sl", 360);     // equals 12 * 1.5 * 20 (Standard lineheight * 1.5  in twips)
                break;
            }
            Translate("LineSpacingRule", "slmult");
            object shad = GetValueAsIntended("Shading");

            if (shad != null)
            {
                new ShadingRenderer((DocumentObject)shad, _docRenderer).Render();
            }

            object font = GetValueAsIntended("Font");

            if (font != null)
            {
                RendererFactory.CreateRenderer((Font)font, _docRenderer).Render();
            }

            object brdrs = GetValueAsIntended("Borders");

            if (brdrs != null)
            {
                BordersRenderer brdrsRndrr = new BordersRenderer((Borders)brdrs, _docRenderer);
                brdrsRndrr.ParentFormat = _format;
                brdrsRndrr.Render();
            }

            object tabStops = GetValueAsIntended("TabStops");

            if (tabStops != null)
            {
                RendererFactory.CreateRenderer((TabStops)tabStops, _docRenderer).Render();
            }

            // TODO: ListInfo is still under construction.
            object listInfo = GetValueAsIntended("ListInfo");

            if (listInfo != null)
            {
                int nr = ListInfoOverrideRenderer.GetListNumber((ListInfo)listInfo);
                if (nr > 0)
                {
                    _rtfWriter.WriteControl("ls", nr);
                }
            }
        }
    /// <summary>
    /// Renders a ParagraphFormat object.
    /// </summary>
    internal override void Render()
    {
      this.useEffectiveValue = true; //unfortunately has to be true always.

      Translate("Alignment", "q");
      Translate("SpaceBefore", "sb");
      Translate("SpaceAfter", "sa");

      TranslateBool("WidowControl", "widctlpar", "nowidctlpar", false);
      Translate("PageBreakBefore", "pagebb");
      Translate("KeepTogether", "keep");
      Translate("KeepWithNext", "keepn");
      Translate("FirstLineIndent", "fi");

      Translate("LeftIndent", "li");
      Translate("LeftIndent", "lin");

      Translate("RightIndent", "ri");
      Translate("RightIndent", "rin");

      object ol = GetValueAsIntended("OutlineLevel");
      if (ol != null && ((OutlineLevel)ol) != OutlineLevel.BodyText)
        Translate("OutlineLevel", "outlinelevel");

      Unit lineSpc = (Unit)GetValueAsIntended("LineSpacing");
      LineSpacingRule lineSpcRule = (LineSpacingRule)GetValueAsIntended("LineSpacingRule");

      switch (lineSpcRule)
      {
        case LineSpacingRule.Exactly: //A bit strange, but follows the RTF specification:
          this.rtfWriter.WriteControl("sl", ToTwips(-lineSpc.Point));
          break;

        case LineSpacingRule.AtLeast:
          Translate("LineSpacing", "sl");
          break;

        case LineSpacingRule.Multiple:
          this.rtfWriter.WriteControl("sl", ToRtfUnit(lineSpc, RtfUnit.Lines));
          break;

        case LineSpacingRule.Double:
          this.rtfWriter.WriteControl("sl", 480); //equals 12 * 2 * 20 (Standard line height * 2  in twips)
          break;

        case LineSpacingRule.OnePtFive:
          this.rtfWriter.WriteControl("sl", 360); //equals 12 * 1.5 * 20 (Standard lineheight * 1.5  in twips)
          break;
      }
      Translate("LineSpacingRule", "slmult");
      object shad = GetValueAsIntended("Shading");
      if (shad != null)
        new ShadingRenderer((DocumentObject)shad, this.docRenderer).Render();

      object font = GetValueAsIntended("Font");
      if (font != null)
        RendererFactory.CreateRenderer((Font)font, this.docRenderer).Render();

      object brdrs = GetValueAsIntended("Borders");
      if (brdrs != null)
      {
        BordersRenderer brdrsRndrr = new BordersRenderer((Borders)brdrs, this.docRenderer);
        brdrsRndrr.ParentFormat = this.format;
        brdrsRndrr.Render();
      }

      object tabStops = GetValueAsIntended("TabStops");
      if (tabStops != null)
        RendererFactory.CreateRenderer((TabStops)tabStops, this.docRenderer).Render();

      // TODO: ListInfo is still under construction.
      object listInfo = GetValueAsIntended("ListInfo");
      if (listInfo != null)
      {
        int nr = ListInfoOverrideRenderer.GetListNumber((ListInfo)listInfo);
        if (nr > 0)
          this.rtfWriter.WriteControl("ls", nr);
      }
    }