VernF88
Registered Users - Approved-
Posts
12 -
Joined
Everything posted by VernF88
-
Remove only 1 word out of text box when field is empty
VernF88 replied to prhoward's topic in FusionPro® VDP Creator
I'm pretty sure a modification of this code could help me. I have a similar situation with three variables in a text frame. The text frame reads: "<<V1>> <<V2>> <<V3>>." The result I'm getting when <<V3>> is empty is: "<<V1>> <<V2>> ." How can I remove the space between "<<V2>> ." without just deleting the static text in the text frame? -
-
I uploaded an image for my meaning. Next to the large "$13,555" are the superscript characters I'm wanting to correct with the rule. As you'll see in the next paragraph down next to the "$1,500 Bonus Cash" the "+" character is the correct height. So the global setting cannot be modified to fix the issue. The code I have in the rule's correct the height and insure they aren't bold: return FormatNumber("$#,###", Field("Actual").replace(/[^\d\.-]/g,'')) + "<p br=false superoffset=175 superratio=30><span bold=false><superscript>++</superscript></span bold=false><p br=false superoffset=58 superratio=50>" That will produce the correct height "++". Literally whats in the text frame is "<<actual>>++" so I input: var chars = { // Find: Replace: '\\^': '<superscript>^</superscript>', '\\+': '<superscript>+</superscript>', '†': '<superscript>†</superscript>', '‡': '<superscript>‡</superscript>', '<<first>>': Field("First Name"), '<<last>>': Field("Last Name"), '<<year>>': Field("Year"), '<<make>>': Field("Make"), '<<model>>': Field("Model"), '<<model2>>': Field("Model2"), '<<model3>>': Field("Model3"), '<<V1>>': Field("V1"), '<<V2>>': Field("V2"), ' <<V3>>': Rule("V3R"), ' <<V4>>': Rule("V4R"), '<<V5>>': Field("V5"), '<<v1>>': Field("V1"), '<<v2>>': Field("V2"), ' <<v3>>': Rule("V3R"), ' <<v4>>': Rule("V4R"), '<<v5>>': Field("V5"), '<<more>>': Rule("MoreR"), [color="Red"]'<<actual>>\\++': Rule("ActualR1"), '<<actual>>\\+': Rule("ActualR2"), '<<actual>>†': Rule("ActualR3"), '<<actual>>‡': Rule("ActualR4"),[/color] '<<actual>>': Rule("ActualR"), '<<winno>>': Field("WinNo"), } var text = FindTextFrame('FullBody').content .replace(/<variable name="([^"]*)">/g, function(s,p) { return FieldOrRule(p); }) .replace(/&([lg])t;/g, function(s,p) { return p == 'l' ? '<' : '>'; }); for (var i in chars) text = text.replace(new RegExp(i, 'g'), chars[i]); FindTextFrame('FullBody').content = text; I realize I could highlight and replace the space holder but that's literally the last thing left in the letter that isn't automated. I appreciate all your help!
-
The only other thing I'm struggling on with this is trying to get something like this to work: '<<actual>>++': Rule("ActualR1"), '<<actual>>+': Rule("ActualR2"), '<<actual>>†': Rule("ActualR3"), '<<actual>>‡': Rule("ActualR4"), The reason being is the "actual" field in the letter is 36 point, so the superscript doesn't go up high enough. I made 4 rules applying each occurrence of the character options at the appropriate superscript height. It won't recognize this as text within the frame though. Thank You!
-
That works great! Thank you again for all your help!!!
-
Hello Dan, Currently we've been attempting this: var chars = { // Find: Replace: '\\^': '<superscript>^</superscript>', '\\+': '<superscript>+</superscript>', '\\†': '<superscript>†</superscript>', '\\‡': '<superscript>‡</superscript>', '<<first>>': Field("First Name"), '<<last>>': Field("Last Name"), '<<year>>': Field("Year"), '<<make>>': Field("Make"), '<<model>>': Field("Model"), '<<model2>>': Field("Model2"), '<<model3>>': Field("Model3"), '<<V1>>': Field("V1"), '<<V2>>': Field("V2"), '<<V3>>': Rule("V3R"), '<<V4>>': Rule("V4R"), '<<V5>>': Field("V5"), '<<more>>': Rule("MoreR"), '<<actual>>': Rule("ActualR"), '<<winno>>': Field("WinNo"), } var text = FindTextFrame('FullBody').content .replace(/<variable name="([^"]*)">/g, function(s,p) { return FieldOrRule(p); }); for (var i in chars) text = text.replace(new RegExp(i, 'g'), chars[i]); FindTextFrame('FullBody').content = text; The rub is that the field's aren't filling because of the "<<>>" on each side of the space holder. Also the alt characters "†" and "‡" aren't being replaced with superscript.
-
Okay for troubleshooting purposes I input 'first' instead of '<<first>>'. It then inserted the field, so it's the <<>> characters causing it to not work properly. Still not sure why the "†" and "‡" characters are not going to superscript though.
-
Here's what I've got after completing what I would want done in the format above: var chars = { // Find: Replace: '\\^': '<superscript>^</superscript>', '\\+': '<superscript>+</superscript>', '\\†': '<superscript>†</superscript>', '\\‡': '<superscript>‡</superscript>', '<<first>>': Field("First Name"), '<<last>>': Field("Last Name"), '<<year>>': Field("Year"), '<<make>>': Field("Make"), '<<model>>': Field("Model"), '<<model2>>': Field("Model2"), '<<model3>>': Field("Model3"), '<<V1>>': Field("V1"), '<<V2>>': Field("V2"), '<<V3>>': Rule("V3R"), '<<V4>>': Rule("V4R"), '<<V5>>': Field("V5"), '<<more>>': Rule("MoreR"), '<<actual>>': Rule("ActualR"), '<<winno>>': Field("WinNo"), } var text = FindTextFrame('FullBody').content .replace(/<variable name="([^"]*)">/g, function(s,p) { return FieldOrRule(p); }); for (var i in chars) text = text.replace(new RegExp(i, 'g'), chars[i]); FindTextFrame('FullBody').content = text; The only thing that is affecting inside of the text frame is the "+" and "^" characters. Am I keying something wrong?
-
When I add in "†" and "‡" characters the rule doesn't seem to move them, also is there a way to make a similar rule to replace place holders? For example "<<first>>" being automatically replaced with "Field("First Name")"?
-
Thank you so much! That works perfectly!
-
Hello, I have a customer who sends us documents that are plastered with disclaimer characters (ex. +, ^, etc.) that they expect us to change to superscript. Currently we highlight each disclaimer character in the text frame and click the "sup" button. I attempted javascript to remedy this with the code provided here modified for my purposes. Is it possible to locate and replace characters within a text frame to superscript? Thank you. Here is my attempt: FusionPro.thisRuleReturnsTaggedText = true; var myFrame = FindTextFrame("FullBody"); myFrame = ReplaceSubstring(myFrame, "+", "<superscript>+</superscript>"); return myFrame;