diff --git a/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/Shape.cs b/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/Shape.cs
index 76a8ec3c..a4e0956e 100644
--- a/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/Shape.cs
+++ b/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/Shape.cs
@@ -125,6 +125,19 @@ public FillFormat FillFormat
}
}
+ ///
+ /// Gets the text in front or behind format of the shape.
+ ///
+ public TextWithShapeFormat TextWithShapeFormat
+ {
+ get => Values.TextWithShapeFormat ??= new TextWithShapeFormat(this);
+ set
+ {
+ SetParent(value);
+ Values.TextWithShapeFormat = value;
+ }
+ }
+
///
/// Gets or sets the height of the shape.
///
@@ -234,6 +247,12 @@ internal ShapeValues(DocumentObject owner) : base(owner)
///
public FillFormat? FillFormat { get; set; }
+ ///
+ /// Gets or sets the internal nullable implementation value of the enclosing document object property.
+ /// See enclosing document object class for documentation of this property.
+ ///
+ public TextWithShapeFormat? TextWithShapeFormat { get; set; }
+
///
/// Gets or sets the internal nullable implementation value of the enclosing document object property.
/// See enclosing document object class for documentation of this property.
diff --git a/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/TextWithShapeFormat.cs b/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/TextWithShapeFormat.cs
new file mode 100644
index 00000000..594ae615
--- /dev/null
+++ b/src/foundation/src/MigraDoc/src/MigraDoc.DocumentObjectModel/DocumentObjectModel.Shapes/TextWithShapeFormat.cs
@@ -0,0 +1,52 @@
+// MigraDoc - Creating Documents on the Fly
+// See the LICENSE file in the solution root for more information.
+
+namespace MigraDoc.DocumentObjectModel.Shapes
+{
+ ///
+ /// A TextWithShapeFormat object
+ /// Defines the background filling of the shape.
+ ///
+ public class TextWithShapeFormat : DocumentObject
+ {
+ ///
+ /// Initializes a new instance of the FillFormat class.
+ ///
+ public TextWithShapeFormat() { }
+
+ ///
+ /// Initializes a new instance of the FillFormat class with the specified parent.
+ ///
+ internal TextWithShapeFormat(DocumentObject parent) : base(parent) { }
+
+ ///
+ /// Creates a deep copy of this object.
+ ///
+ public new TextWithShapeFormat Clone()
+ => (TextWithShapeFormat)DeepCopy();
+
+ ///
+ /// Gets or sets a value indicating whether the text should be in front of the shape.
+ ///
+ public bool? TextInFront { get; set; }
+
+ ///
+ /// Converts FillFormat into DDL.
+ ///
+ internal override void Serialize(Serializer serializer)
+ {
+ int pos = serializer.BeginContent("TextWithShapeFormat");
+ if (this.TextInFront.HasValue)
+ serializer.WriteSimpleAttribute("TextInFront", this.TextInFront.Value);
+
+ serializer.EndContent();
+ }
+
+ ///
+ /// Returns the meta object of this instance.
+ ///
+ internal override Meta Meta => TheMeta;
+
+ static readonly Meta TheMeta = new(typeof(TextWithShapeFormat));
+ }
+}
diff --git a/src/foundation/src/MigraDoc/src/MigraDoc.RtfRendering/RtfRendering/ShapeRenderer.cs b/src/foundation/src/MigraDoc/src/MigraDoc.RtfRendering/RtfRendering/ShapeRenderer.cs
index ea9cafe4..dba6ec86 100644
--- a/src/foundation/src/MigraDoc/src/MigraDoc.RtfRendering/RtfRendering/ShapeRenderer.cs
+++ b/src/foundation/src/MigraDoc/src/MigraDoc.RtfRendering/RtfRendering/ShapeRenderer.cs
@@ -57,6 +57,7 @@ void RenderShapeAttributes()
}
RenderLineFormat();
RenderFillFormat();
+ RenderTextWithShapeFormat();
}
///
@@ -74,6 +75,15 @@ protected void RenderFillFormat()
RenderNameValuePair("fFilled", "0");
}
+ protected void RenderTextWithShapeFormat()
+ {
+ var tf = GetValueAsIntended("TextWithShapeFormat") as TextWithShapeFormat;
+ if (tf != null && tf.TextInFront.HasValue && tf.TextInFront.Value)
+ RenderNameValuePair("fBehindDocument", "0");
+ else
+ RenderNameValuePair("fBehindDocument", "1");
+ }
+
protected Unit GetLineWidth()
{
var lf = GetValueAsIntended("LineFormat") as LineFormat;