Eric Patrick Posted February 1, 2016 Posted February 1, 2016 I have a variable text box with a border on it. I need to resize the Border based on the size of the variable. Can this be done?49868_LTR_SBN8_VAR.zip Quote
Dan Korn Posted February 1, 2016 Posted February 1, 2016 I looked at the attached job, but I couldn't figure out what you mean by "resize the Border based on the size of the variable." So I can't give you an algorithm, but in general, the answer is Yes, you can indeed adjust the width of a frame border. In OnRecordStart, access the named frame with FindTextFrame(), then set the returned FusionProTextFrame object's borderThickness property, in hundredths of points (7200 per inch). For instance: FindTextFrame("YourFrameName").borderThickness = 7200; // one inch Or did you mean that you want to resize the entire frame? That can be done as well, by setting the width and height properties, and you can also set the x and y properties to move a frame's position. However, you need to compose with a FusionPro VDP Producer or Server license to move and resize frames in this way. Quote
Eric Patrick Posted February 1, 2016 Author Posted February 1, 2016 I am needing to resize the entire frame so that the border is approx an 1/8" from the text on the left and right sides. Sounds like I would need to get a Producer or server license to be able to make this happen. Thanks for the quick reply. Quote
step Posted February 1, 2016 Posted February 1, 2016 You just need to make a variable width table using TextMeasure: var str = ToUpper(Field("City")) + ' SECURITY NOTICE'; var space = 900; // .125 inches == 900 function getTextWidth(input){ var tm = new FusionProTextMeasure; tm.font = "Univers 65 Bold"; tm.pointSize = "14pt"; tm.CalculateTextExtent(input); var result = tm.textWidth; return (result*1.1) + space*2; } var table = new FPTable(); table.AddColumn(getTextWidth(str)) var row = table.AddRow(); var cell = row.Cells[0] cell.SetBorders('Thin','Black','Top','Bottom','Right','Left'); cell.VAlign = "Middle"; cell.Margins = {'Left':space, 'Right': space, 'Top': space/10, 'Bottom': space/10}; row.SetContents(str); return table.MakeTags().replace(/^\<table/, "<table alignment=center"); Here's a similar thread. Quote
Eric Patrick Posted February 1, 2016 Author Posted February 1, 2016 That worked like a charm. I really appreciate the help. This has a load of uses for things we want to be able to provide clients. Quote
GreggRusson Posted September 1, 2016 Posted September 1, 2016 Hey Step, A quick question on a post in this thread (#4). In your function getTextWidth(input), you're returning the tm.textWidth * 1.1. I get the space * 2 to get the 1/8 inch left/right margins the original poster said he wanted, but why multiply the textWidth * 1.1? Just curious... TIA Gregg Quote
step Posted September 2, 2016 Posted September 2, 2016 That's a good question, Gregg. I don't really remember but if I had to guess, I'd say it was to include a little "wiggle room" in case the measurement of the text wasn't entirely accurate. I've noticed that sometimes if you set the width of the table to the exact width of the text, the text can occasionally overflow so multiplying the width by 1.1 just adds a 10% buffer. Quote
scotts Posted November 12, 2018 Posted November 12, 2018 Ste, Thank you very much for all your post, but especially on this post. I would not have been able to achieve my goals on a project without your guidance. You are a wealth of knowledge. Quote
AshleyParks Posted November 4, 2022 Posted November 4, 2022 I'm fairly new to FP and I'm struggling. Hopefully someone cane help. I have a text frame that has a black outlined border. Depending on the information of the text, the text frame may not be full. So there will be space at the bottom on some records and other records the box will be full. What I would like to do is have the frame shrink up where the words would end and expand down when there are more words in the box. Copyfit doesn't work fully in this situation, I don't want to smaller amount of words to expand to fill, I need it to stay the same size. I attached 2 pictures to maybe help explain what i want to do. I'm trying the ResizeFrame function, but I'm having trouble writing it. I'm missing something 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.