View Single Post
  #1  
Old September 20th, 2019, 02:36 PM
geeool geeool is offline
Junior Community Member
 
Join Date: Jun 2012
Location: Hilliard, OH
Posts: 22
Default How to escape special characters in a table?

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.");
Full table code below. Any suggestions?

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
Thanks for the help.
Attached Images
File Type: jpg Capture.JPG (60.3 KB, 3 views)
Reply With Quote