/// <summary> /// Renders the RelativeVerticalattribute. /// </summary> void RenderRelativeVertical() { if (RenderInParagraph()) { RenderNameValuePair("posrelv", "3"); } else { //We need to write both shpby and posrelv which are almost equivalent. //Translate("RelativeVertical", "shpby", RtfUnit.Undefined, "para", false); object relVrtObj = GetValueAsIntended("RelativeVertical"); RelativeVertical relVrt = relVrtObj == null ? RelativeVertical.Paragraph : (RelativeVertical)relVrtObj; switch (relVrt) { case RelativeVertical.Line: RenderNameValuePair("posrelv", "3"); break; case RelativeVertical.Margin: RenderNameValuePair("posrelv", "0"); break; case RelativeVertical.Page: RenderNameValuePair("posrelv", "1"); break; case RelativeVertical.Paragraph: RenderNameValuePair("posrelv", "2"); break; } } }
/// <summary> /// Renders (and calculates) the \shptop and \shpbottom controls in RTF. /// </summary> private void RenderTopBottom() { Unit height = GetShapeHeight(); Unit top = 0; Unit bottom = height; if (!RenderInParagraph()) { RelativeVertical relVert = (RelativeVertical)GetValueOrDefault("RelativeVertical", RelativeVertical.Paragraph); TopPosition topPos = (TopPosition)GetValueOrDefault("Top", new TopPosition()); //REM: Will not work like this in table cells. //=>The shape would have to be put in a paragraph there. Section sec = (Section)DocumentRelations.GetParentOfType(_shape, typeof(Section)); PageSetup pgStp = sec.PageSetup; Unit topMrg = (Unit)pgStp.GetValue("TopMargin", GV.ReadOnly); Unit btmMrg = (Unit)pgStp.GetValue("BottomMargin", GV.ReadOnly); Unit pgHeight = pgStp.PageHeight; Unit pgWidth = pgStp.PageWidth; if (topPos.ShapePosition == ShapePosition.Undefined) { top = topPos.Position; bottom = top + height; } else { switch (relVert) { case RelativeVertical.Line: AlignVertically(topPos.ShapePosition, height, out top, out bottom); break; case RelativeVertical.Margin: AlignVertically(topPos.ShapePosition, pgHeight.Point - topMrg.Point - btmMrg.Point, out top, out bottom); break; case RelativeVertical.Page: AlignVertically(topPos.ShapePosition, pgHeight, out top, out bottom); break; } } } RenderUnit("shptop", top); RenderUnit("shpbottom", bottom); }
/// <summary> /// Initializes a new instance of the <see cref="PdfAddress" /> class. /// </summary> /// <param name="title">The title.</param> /// <param name="addressLines">The address lines.</param> /// <param name="top">The top.</param> /// <param name="left">The left.</param> /// <param name="height">The height.</param> /// <param name="relativeVertical">The relative vertical.</param> public PdfAddress( string title, IEnumerable <TextLine> addressLines, int top = 0, int left = 0, //int width = 205, int height = 120, RelativeVertical relativeVertical = RelativeVertical.Line) { _title = title; _addressLines = addressLines; _top = top; _left = left; //_width = width; _height = height; _relativeVertical = relativeVertical; }
public MezImage RelativeVertical(RelativeVertical relativeVertical) { Image.RelativeVertical = relativeVertical; return(this); }