gregmaze Posted March 26, 2018 Posted March 26, 2018 Hello... I am trying to create a table that has 3 variable items. Logo, Department and Division. The logo has to be in the left, and the Department and Division are on the right, and the Division will be under the Department and flush right. The attached zip file will show that I can get this, except I want the logo to be justified/positioned to the bottom of the second line. My problem is I cannot figure out how to get the logo to be positioned at bottom. The sample shows it at the bottom of baseline line 1. I would appreciate any help someone can give. Thanks Greg Mac OS 10.13 Fusion Pro 10Var-Notepad-v3.zip Quote
Dan Korn Posted March 27, 2018 Posted March 27, 2018 Do you really need a table here, with multiple rows of data? Or are you just trying to position the three variable items in a particular way? I suspect it's the latter, that you don't really need a multi-row table. So I think the easiest answer, building on what you already have, is to put the graphic into its own cell (column) in the single-row table, like so: var strLogo = Resource("BMCLogo").content; var str = '<span font="Arial" pointsize=16>' + Field("Department") + '</span><br>' + '<span font="Arial Narrow" pointsize=13>' + Field("Division") + '</span><br>'; function getTextWidth(input) { var tm = new FusionProTextMeasure; tm.CalculateTextExtent(input); return tm.textWidth; } var table = new FPTable(); table.Alignment = "Center"; table.AddColumn(getTextWidth(strLogo)); table.AddColumn(getTextWidth(str)); var row = table.AddRow(); var cell = row.Cells[0]; cell.VAlign = "Bottom"; //cell.HAlign = "Right"; cell.Margins = {Top:0, Bottom:0, Left:0, Right:0}; //cell.SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right"); row.CopyCells(0, 1); row.SetContents(strLogo, str); return table.MakeTags(); Note that you don't need any "fudge" factor if the cell margins are all set to zero. Also, in this particular case, the bottom of the graphic may not appear perfectly visually aligned to the bottom of the text, but that's because the PDF graphic has some white space at the bottom. Quote
gregmaze Posted March 27, 2018 Author Posted March 27, 2018 Hello Dan, Thank you for the reply. I was finally able to get it to work... but as I noticed after reading your solution. You code is much cleaner... My code did have a lot of "Fudging" though. I will use your solution, it is much easier to understand too... Thanks again Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.