|
#1
|
|||
|
|||
![]()
Hi,
I have a business card where my client wants to use a carrot '>' symbol between the label and the phone number (see attached screen capture for reference). I decided to use a table for laying out the numbers because the top number will sometimes have an extension, so it needs to float. As I'm building my table and testing it, I'm finding that the carrot '>' symbol won't display. I've tried escaping it, but that hasn't worked. Code:
var office = 'O '+'/\(>\)/ '+' '+Rule("OfficePhoneRULE")+' Ext.'+Field("Ext."); Code:
var table = new FPTable; var NoR = 3// NoR = number of rows (one less than actual) // Setting the table width of the columns table.AddColumns(6000, 1000, 10000); table.AddRows(4); // Adds the number of rows to the table. for(a=0;a<=NoR;a++) // Counter for building the rows (rows 0 thru 3) { for(b=0;b<1;b++) // Counter for building the cells (cell 0 ) { table.Rows[a].Cells[b].SetBorders("Thin", "Red", "Top", "Bottom", "Left", "Right"); // Adds red line around table cell table.Rows[a].Cells[b].Margins = new FPTableMargins; // This needs to be set every time the margins change table.Rows[a].Cells[b].Margins.Top = 55; // I had to have a larger Top Margin to make the text look centered between the top and bottom borders table.Rows[a].Cells[b].Margins.Bottom = 55; table.Rows[a].Cells[b].Margins.Left = 200; table.Rows[a].Cells[b].Margins.Right = 200; table.Rows[a].Cells[b].Font = "Knockout HTF31-JuniorMiddlewt"; // This sets the font for the first cell, the second is set at the text frame. table.Rows[a].Cells[b].TextColor = "Black"; // This sets the font for the first cell, the second is set at the text frame. } for(c=1;c<2;c++) // Counter for building the cells (cell 1) { table.Rows[a].Cells[c].SetBorders("Thin", "Red", "Top", "Bottom", "Left", "Right"); // Adds red line around table cell table.Rows[a].Cells[c].Margins = new FPTableMargins; // This needs to be set every time the margins change table.Rows[a].Cells[c].Margins.Top = 55; // I had to have a larger Top Margin to make the text look centered between the top and bottom borders table.Rows[a].Cells[c].Margins.Bottom = 55; table.Rows[a].Cells[c].Margins.Left = 200; table.Rows[a].Cells[c].Margins.Right = 200; } for(d=2;d<3;d++) // Counter for building the cells (cell 2) { table.Rows[a].Cells[d].SetBorders("Thin", "Red", "Top", "Bottom", "Left", "Right"); // Adds red line around table cell table.Rows[a].Cells[d].Margins = new FPTableMargins; // This needs to be set every time the margins change table.Rows[a].Cells[d].Margins.Top = 55; // I had to have a larger Top Margin to make the text look centered between the top and bottom borders table.Rows[a].Cells[d].Margins.Bottom = 55; table.Rows[a].Cells[d].Margins.Left = 200; table.Rows[a].Cells[d].Margins.Right = 200; } } for(i=0;i<=4;i++) { //var prep_field_num = i+1; //var prep_field = 'Instruction'+prep_field_num; var ext = Field("Ext."); var office = 'O '+'/\(>\)/ '+' '+Rule("OfficePhoneRULE")+' Ext.'+Field("Ext."); var store = Field("S"); var mobile = Field("M"); var fax = Field("F"); if (ext != "") { table.Rows[0].Cells[0].Margins = new FPTableMargins; // This needs to be set every time the margins change table.Rows[0].Cells[0].Margins.Top = 65; // I had to have a larger Top Margin to make the text look centered between the top and bottom borders table.Rows[0].Cells[0].Margins.Bottom = 40; table.Rows[0].Cells[0].Margins.Left = 200; table.Rows[0].Cells[0].Margins.Right = 200; table.Rows[0].Cells[0].Font = "Knockout HTF31-JuniorMiddlewt"; table.Rows[0].Cells[0].PointSize= "8"; table.Rows[0].Cells[0].HStraddle = 3; table.Rows[0].Cells[0].Content = office; } if (store != "") { // if field contains *h2* it will be a headline table.Rows[1].Cells[1].Margins = new FPTableMargins; // This needs to be set every time the margins change table.Rows[1].Cells[1].Margins.Top = 65; // I had to have a larger Top Margin to make the text look centered between the top and bottom borders table.Rows[1].Cells[1].Margins.Bottom = 40; table.Rows[1].Cells[1].Margins.Left = 200; table.Rows[1].Cells[1].Margins.Right = 200; table.Rows[1].Cells[1].Font = "Knockout HTF31-JuniorMiddlewt"; table.Rows[1].Cells[1].PointSize= "8"; table.Rows[1].Cells[1].Content = store; //removing the *h2* in front of the field content } else { // When an empty field is encountered, break loop and build table break; } } table = table.MakeTags(); // This is required return table; // This is required |
#2
|
||||
|
||||
![]()
As you can see if you click Validate in the rule, the table that's being returned is a bunch of HTML/XML-like tagged markup, so that means you have to follow tagged markup guidelines for certain characters which have special meanings, such as angle brackets <> to denote a tag, single- and double-quotes, and ampersands. You could use entities such as < to represent such characters literally in tagged markup, but that can get tricky. Fortunately, there's a function that can do all the necessary entity replacements for you, called TaggedTextFromRaw. So you can just do this:
Code:
var office = TaggedTextFromRaw('O > ' + Rule("OfficePhoneRULE") + ' Ext.' + Field("Ext."));
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Forum Moderator PTI Marketing Technologies | Printable | MarcomCentral I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com. Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs. This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages. Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance. Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support. How To Ask Questions The Smart Way The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript. Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5. return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)}); ![]() |
#3
|
|||
|
|||
![]()
Thanks Dan, that worked!
|
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|