Jump to content

Variable text color in table


Hawk

Recommended Posts

Posted

I am creating a table from an external data file. I need the text color of a row to be red if there is a Y in the last column of the external file. Can't seem to get it.

 

Here is what i have so far.

 

numRecsExtDF = XDFTop.recordCount;

var numRecsExtDF = XDFTop.recordCount;

var  myTable = '<table columns="6" Space="Above:180;Below:180" Alignment="Center" Margins="Top:60;Bottom:60;Left:60;Right:60"' 
myTable +='BoxRules="Top:thin,BLACK;Bottom:thin,BLACK;Left:thin,BLACK;Right:thin,BLACK" HeaderRules="Rule:thin,BLACK;" '
myTable +='ColumnRules="Freq:1;Default:thin,BLACK;Alternate:thin,BLACK" RowRules="Freq:1;Default:thin,BLACK;Alternate:thin,BLACK">'
myTable +='<column width=8000><column width=8000><column width=12000><column width=8000><column width=8000><column width=8000>'
myTable += '<row><cell margins="top:030;bottom:030"><p br=false quad=C>Provider Type<br />(renering service)'
        myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>Last Known<br />ICD-9 Code'
        myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>ICD-9<br />Description'
        myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>Date Last<br />Confirmed'
        myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>DHCC<br />Grouping'
        myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>Need to be<br />Confirmed in<br />2012 (Y/N)'
for (i=0; i <= numRecsExtDF; i++)
{      

   if (XDFTop.GetFieldValue(i, 0)==Field("hicn"))
   {   

       myTable += '<row>'
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 1))
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 2))
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 3))
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 4))
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 5))
       myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C>'+ NormalizeEntities(XDFTop.GetFieldValue(i, 6))

   }
}  
 myTable += '</table>';
 return  myTable;

 

I can't even change the color with a color tag.

 

I'm using VDP Creator 8. And Acrobat 9.

 

Thanks,

Larry

Posted
I can't even change the color with a color tag.

I don't see why not. This works for me, at line 22:

 

myTable += '<cell margins="top:030;bottom:030"><p br=false quad=C><color name=Red>' + NormalizeEntities(XDFTop.GetFieldValue(i, 1))

  • 2 months later...
Posted

I know there is a rule to make a text box or picture box color variable.

if (filename.indexOf("13A2_9_BlockBuster_p1.jpg") > -1) {

theframeP1.fillColorName = "Blockbuster";

theframeP1.fillColorPercent = 100;

Posted
Is there a way to do this with a color value rather than using a named color? We have a client that can use lots of many colors. Using the rule above, every time they want to add a new color, we'd have to open the template & recollect it. I'd like to give them a color picker & let them send color values if possible.
Posted
Is there a way to do this with a color value rather than using a named color? We have a client that can use lots of many colors. Using the rule above, every time they want to add a new color, we'd have to open the template & recollect it. I'd like to give them a color picker & let them send color values if possible.

Yes, with FusionPro 8.1 or later, you can call “new FusionProColor” to create a color. The signature is:

new FusionProColor(name [,cyan] [,magenta] [,yellow] [,black] [,isSpot])

Where the CYMK values are percentages. You can find this in the Building Blocks dialog, on the Objects tab, under the “Resources” node.

 

An example is:

var myColor = new FusionProColor("Brown", 0, 3, 5, 62);
FindTextFrame("Title").fillColorName = "Brown";

Of course, the values can come from data fields, like so:

var myColor = new FusionProColor("User Color", Int(Field("Cyan"), Int(Field("Yellow"), Int(Field("Magenta"), Int(Field("Black"));
FindTextFrame("Title").fillColorName = "User Color";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...