Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

  • 6 months later...
Posted

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

Posted
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.
  • 2 years later...
Posted

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.

  • 3 years later...
Posted

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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...