F2022-017: Barakah - For Word Document sections, allow end message to include Section number

This commit is contained in:
Kathy Ruffing 2022-04-06 14:30:51 +00:00
parent 6355ba39af
commit 3eb3c14752

View File

@ -1303,9 +1303,13 @@ namespace Volian.Print.Library
float ylocation = cb.PdfDocument.PageSize.Height - ((float)mySection.MyDocStyle.Layout.TopMargin + locEndOfWordDoc * 72); // 72 - pts per inch.
iTextSharp.text.Font fnt = VolianPdf.GetFont(mySection.MyDocStyle.End.Font.WindowsFont);
fnt.Color = new iTextSharp.text.Color(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
iTextSharp.text.Paragraph para = new Paragraph(mySection.MyDocStyle.End.FixedMessage, fnt);
// F2022-017: For Word Document sections, allow the message to have the '{Section Number}' token that
// gets resolved by the section's DisplayNumber.
string myMsg = mySection.MyDocStyle.End.FixedMessage;
if (myMsg.Contains("{Section Number}")) myMsg = myMsg.Replace("{Section Number}", mySection.DisplayNumber).Trim();
iTextSharp.text.Paragraph para = new Paragraph(myMsg, fnt);
float wtpm = (float)mySection.MyDocStyle.Layout.PageWidth - (float)mySection.MyDocStyle.Layout.LeftMargin;
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (mySection.MyDocStyle.End.Message.Length * mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
float centerpos = (float)mySection.MyDocStyle.Layout.LeftMargin + (wtpm - (myMsg.Length * (float)mySection.MyDocStyle.End.Font.CharsToTwips)) / 2;
float yBottomMargin = Math.Max(0, (float)mySection.MyDocStyle.Layout.TopMargin - (float)mySection.MyDocStyle.Layout.PageLength - 2 * vlnPrintObject.SixLinesPerInch);
float adjMsgY = 0;
if ((float)mySection.MyDocStyle.End.Flag < 0) // Adjust this many lines down the page.