Наследование: iTextSharp.text.rtf.RtfAddableElement
Пример #1
0
 /**
 * Sets a property.
 *
 * @param property The property to set for this RtfShape.
 */
 public void SetProperty(RtfShapeProperty property)
 {
     this.properties[property.GetName()] = property;
 }
Пример #2
0
 /**
 * Sets a property.
 * 
 * @param property The property to set for this RtfShape.
 */
 public void SetProperty(RtfShapeProperty property) {
     property.SetRtfDocument(this.doc);
     this.properties[property.GetName()] = property;
 }
Пример #3
0
 /**
  * Sets a property.
  *
  * @param property The property to set for this RtfShape.
  */
 public void SetProperty(RtfShapeProperty property)
 {
     this.properties[property.GetName()] = property;
 }
Пример #4
0
 /**
  * Sets a property.
  *
  * @param property The property to set for this RtfShape.
  */
 public void SetProperty(RtfShapeProperty property)
 {
     property.SetRtfDocument(this.doc);
     this.properties[property.GetName()] = property;
 }
Пример #5
0
        /// <summary>
        /// Writes the RtfShape. Some settings are automatically translated into
        /// or require other properties and these are set first.
        /// </summary>
        public override void WriteContent(Stream result)
        {
            _shapeNr = Doc.GetRandomInt();

            _properties["ShapeType"] = new RtfShapeProperty("ShapeType", _type);
            if (_position.IsShapeBelowText())
            {
                _properties["fBehindDocument"] = new RtfShapeProperty("fBehindDocument", true);
            }
            if (InTable)
            {
                _properties["fLayoutInCell"] = new RtfShapeProperty("fLayoutInCell", true);
            }
            if (_properties.ContainsKey("posh"))
            {
                _position.SetIgnoreXRelative(true);
            }
            if (_properties.ContainsKey("posv"))
            {
                _position.SetIgnoreYRelative(true);
            }

            byte[] t;
            result.Write(RtfElement.OpenGroup, 0, RtfElement.OpenGroup.Length);
            result.Write(t = DocWriter.GetIsoBytes("\\shp"), 0, t.Length);
            result.Write(t = DocWriter.GetIsoBytes("\\shplid"), 0, t.Length);
            result.Write(t = IntToByteArray(_shapeNr), 0, t.Length);
            _position.WriteContent(result);
            switch (_wrapping)
            {
            case SHAPE_WRAP_NONE:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr3"), 0, t.Length);
                break;

            case SHAPE_WRAP_TOP_BOTTOM:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr1"), 0, t.Length);
                break;

            case SHAPE_WRAP_BOTH:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr2"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk0"), 0, t.Length);
                break;

            case SHAPE_WRAP_LEFT:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr2"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk1"), 0, t.Length);
                break;

            case SHAPE_WRAP_RIGHT:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr2"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk2"), 0, t.Length);
                break;

            case SHAPE_WRAP_LARGEST:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr2"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk3"), 0, t.Length);
                break;

            case SHAPE_WRAP_TIGHT_BOTH:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr4"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk0"), 0, t.Length);
                break;

            case SHAPE_WRAP_TIGHT_LEFT:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr4"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk1"), 0, t.Length);
                break;

            case SHAPE_WRAP_TIGHT_RIGHT:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr4"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk2"), 0, t.Length);
                break;

            case SHAPE_WRAP_TIGHT_LARGEST:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr4"), 0, t.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shpwrk3"), 0, t.Length);
                break;

            case SHAPE_WRAP_THROUGH:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr5"), 0, t.Length);
                break;

            default:
                result.Write(t = DocWriter.GetIsoBytes("\\shpwr3"), 0, t.Length);
                break;
            }
            if (InHeader)
            {
                result.Write(t = DocWriter.GetIsoBytes("\\shpfhdr1"), 0, t.Length);
            }
            if (Doc.GetDocumentSettings().IsOutputDebugLineBreaks())
            {
                result.WriteByte((byte)'\n');
            }
            result.Write(RtfElement.OpenGroup, 0, RtfElement.OpenGroup.Length);
            result.Write(t = DocWriter.GetIsoBytes("\\*\\shpinst"), 0, t.Length);
            foreach (RtfShapeProperty rsp in _properties.Values)
            {
                rsp.WriteContent(result);
            }
            if (!_shapeText.Equals(""))
            {
                result.Write(RtfElement.OpenGroup, 0, RtfElement.OpenGroup.Length);
                result.Write(t = DocWriter.GetIsoBytes("\\shptxt"), 0, t.Length);
                result.Write(RtfElement.Delimiter, 0, RtfElement.Delimiter.Length);
                result.Write(t = DocWriter.GetIsoBytes(_shapeText), 0, t.Length);
                result.Write(RtfElement.CloseGroup, 0, RtfElement.CloseGroup.Length);
            }
            result.Write(RtfElement.CloseGroup, 0, RtfElement.CloseGroup.Length);
            Doc.OutputDebugLinebreak(result);
            result.Write(RtfElement.CloseGroup, 0, RtfElement.CloseGroup.Length);
        }