Jump to content

Alignment change between Connected Text Frames


Drew H

Recommended Posts

I have text flowing from Frame A into connected Frame B.

I want the text in Frame A to be right aligned, but the text in frame B to be left aligned.

The Variable Text Editor will only allow me to set it statically, but I have variables that could be empty lines - leaving an unsure number of lines flowing into Frame B.

How can I have Frame B force left aligned text?

Link to comment
Share on other sites

Hi Drew,

The expectation is that the text would flow from one frame to the next and keep its formatting, kind of like wrapping around a picture. In order to accomplish what you need, you'll need to measure the text, adding content until it no longer fits in a frame, and then put that in as 2 paragraphs, one left aligned and one right aligned.

If you're willing to send the job to FusionProSupport@marcom.com we can take a look at it.

Link to comment
Share on other sites

Sure thing Douglas, I'll send it in.

I know I can accommodate 5 lines in Frame A - the problem is that it won't always be the same 5 lines. This is a business card, and it has Direct, Cell, and Main phone number entries. Users may include all 3 or none - which results in 3 additional variables being pushed into Frame B (where they need to dynamically align left) or staying in Frame A (where they need to align right).

 

image.png

Link to comment
Share on other sites

Unfortunately, FusionPro support was very unhelpful. The support person seemed very uninterested in reading my explanation, this forum thread, or understanding what I was trying to do - but I was able to solve the problem using chatGPT to write javascript alone (instead of using FusionPro connected frames).

I used two javascript rules. One to create a text block using the first 5 non-blank fields, and another to create a textblock using any non-blank fields that did not fit into the first texblock.

I'm sure it's not elegant, but it allowed me to create the illusion of text flow, but separately - so I could format the text as needed per frame.

 

First Text Block rule

//create a text block containing the first 5 non-blank variables (including some necessary added text before specific fields).
var textBlock1 = "";
var fields = [
    Field("Street Address"),
    Field("City State ZIP"),
    Rule("Direct Format RULE"),
    Rule("Cell Format RULE"),
    Rule("Main Format RULE"),
    Field("Email"),
    Field("Website"),
    Field("NMLS")
];

var maxFields = 5;
var includedFields = 0;

for (var i = 0; i < fields.length; i++) {
    if (fields[i] !== "") {
        if (i === 2 && fields[i] !== "") {
            textBlock1 += "Direct: " + fields[i] + "\r\n";
        } else if (i === 3 && fields[i] !== "") {
            textBlock1 += "Cell: " + fields[i] + "\r\n";
        } else if (i === 4 && fields[i] !== "") {
            textBlock1 += "Main: " + fields[i] + "\r\n";
        } else if (i === 7 && fields[i] !== "") {
            textBlock1 += "NMLS # " + fields[i] + "\r\n";
        } else {
            textBlock1 += fields[i] + "\r\n";
        }
        includedFields++;
        if (includedFields >= maxFields) {
            break;
        }
    }
}

return textBlock1;

 

Second Text Block Rule

//create a text block containing any variables that did not fit into the first text block (including some necessary added text before specific fields).
var textBlock1 = "";
var textBlock2 = "";
var fields = [
    Field("Street Address"),
    Field("City State ZIP"),
    Rule("Direct Format RULE"),
    Rule("Cell Format RULE"),
    Rule("Main Format RULE"),
    Field("Email"),
    Field("Website"),
    Field("NMLS")
];

var maxFields = 5;
var includedFields = 0;

for (var i = 0; i < fields.length; i++) {
    if (fields[i] !== "") {
        if (includedFields < maxFields) {
            if (i === 2) {
                textBlock1 += "Direct: " + fields[i] + "\r\n";
            } else if (i === 3) {
                textBlock1 += "Cell: " + fields[i] + "\r\n";
            } else if (i === 4) {
                textBlock1 += "Main: " + fields[i] + "\r\n";
            } else if (i === 7) {
                textBlock1 += "NMLS #: " + fields[i] + "\r\n";
            } else {
                textBlock1 += fields[i] + "\r\n";
            }
        } else {
            if (i === 2) {
                textBlock2 += "Direct: " + fields[i] + "\r\n";
            } else if (i === 3) {
                textBlock2 += "Cell: " + fields[i] + "\r\n";
            } else if (i === 4) {
                textBlock2 += "Main: " + fields[i] + "\r\n";
            } else if (i === 7) {
                textBlock2 += "NMLS #: " + fields[i] + "\r\n";
            } else {
                textBlock2 += fields[i] + "\r\n";
            }
        }
        includedFields++;
    }
}

return textBlock2;

 

Link to comment
Share on other sites

  • 1 month later...

Drew,

Sorry, that you didn't get a good experience with FusionPro Support. This would be something they would have to task to one of their programmers.

You could use a text rule like this with 2 text frames and it should what I think you want. Put this rule in Frame A and then link it to Frame B.

//Rule_info
var myinfo = "";

//Creating an array to see how many fields are being used.
//You can swop out any of these with the rules with the prefix text ("Direct: ", "Cell: ", "Main: ", or "NMLS #")
var allinfo = [Field("Street Address"),Field("City State ZIP"),Field("Direct"),Field("Cell"),Field("Main"),Field("Email"),Field("Website"),Field("NMLS")];

//This is the tagged markup for the right justified text with a leading of 9pt
var rightjust = '<p style="(no style)" override="true" quad="R" leading="90" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" keeplines="true" widows="1" kerning="true" hyphenate="false" skipifempty="true" skipifemptyvar="false" noparabreakoncopyfit="false"><tracking newsize="0"><f name="ITC Avant Garde Std Bk"><z newsize="7.0"><color name="C=0 M=100 Y=0 K=0">';

//This is the tagged markup for the left justified text with a leading of 9pt
var leftjust = '<p style="(no style)" override="true" quad="L" leading="90" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" keeplines="true" widows="1" kerning="true" hyphenate="false" skipifempty="true" skipifemptyvar="false" noparabreakoncopyfit="false"><tracking newsize="0"><f name="ITC Avant Garde Std Bk"><z newsize="7.0"><color name="C=0 M=100 Y=0 K=0">';

//This is the loop to pull everything in
for (i=0; i<allinfo.length; i++)
{
    if (i<5)
        var mysep = rightjust+'<p>';    //This sets the right justification for the first 5 fields
    else
        var mysep = leftjust+'<p>';    //This sets the left justification for the rest
        
    if (i < 1)
        myinfo = AppendText(myinfo, "", rightjust + allinfo[i]);    //set the right justification for the first field
    else
        myinfo = AppendText(myinfo, mysep, allinfo[i]);
}
return myinfo;


//You can put this in the Javascript Globals so you can use it in all rules.
function AppendText(FullText, Delimiter, NewText)
{
    if (NewText != "")
    {
        if (FullText != "")
            FullText += Delimiter;
        FullText += NewText;
    }
    return FullText;
}

Link to comment
Share on other sites

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...