I'm trying to set the position of a TextFramein the header but can't get it to position correctly. Seems there's a problem with using WrapFormat.Style. If I set it to WrapStyle.Through, the TextFrame positions itself directly under anything else that is above it. If I take that out, then it positions itself where I specify. The problem is, I'm trying to put another TextFrame to the left of it slightly lower but can't get that position set correctly either. Setting the TOP position does nothing when WrapStyle is set.. How can I set the TextFrame TOP position and still use WrapStyle?
Code:
TextFrame tf = sec.Headers.Primary.AddTextFrame();
tf.LineFormat.Width = 0.25;
tf.Left = new Unit(9.5, UnitType.Centimeter);
tf.Top = new Unit(3.175, UnitType.Centimeter);
tf.Width = new Unit(((sec.PageSetup.PageWidth.Centimeter - (sec.PageSetup.LeftMargin.Centimeter + sec.PageSetup.RightMargin.Centimeter)) / 2) + 0.1, UnitType.Centimeter);
tf.WrapFormat.Style = WrapStyle.Through;
paragraph = tf.AddParagraph();
paragraph.AddText("LINE 1");
paragraph.AddLineBreak();
paragraph.AddText("LINE 2");
paragraph.AddLineBreak();
paragraph.AddLineBreak();
paragraph.AddText("OTHER INFO 1");
paragraph.AddLineBreak();
paragraph.AddText("OTHER INFO 2");
TextFrame tf2 = sec.Headers.Primary.AddTextFrame();
tf2.Top = new Unit(2.5, UnitType.Centimeter);
tf2.MarginBottom = "0.1";
tf2.Height = new Unit(12);
tf2.LineFormat.Width = 0.25;
tf2.WrapFormat.Style = WrapStyle.Through;
paragraph = tf2.AddParagraph();
paragraph.Format.Font.Size = new Unit(10);
paragraph.AddText("Additional Info:");
paragraph.Format.Font.Name = "Arial";
paragraph.Format.Font.Bold = true;
TextFrame tf3 = sec.Headers.Primary.AddTextFrame();
//tf3.Top = "4.7cm";
tf3.Width = "9.0cm";
tf3.Height = "2.116666667cm";
//tf3.Top = "2.5cm";
tf3.LineFormat.Width = 0.25;
tf3.MarginTop = "0.185208333cm";
tf3.MarginLeft = "0.185208333cm";
tf3.WrapFormat.Style = WrapStyle.Through;
paragraph = tf3.AddParagraph();
paragraph.AddText("Some more info goes here");