Jump to content

Recommended Posts

Posted

I really didn't want to post this but after hours of searching I couldn't find a reason.

 

I have two templates that use this code. One of the templates refuses to turn the text of the table white.

 

I have:

  • Made the made Variable in the Text Frame as White text
  • I have edited my Table rule so both outcomes show as White
  • I have edited the outcome for other variables other than "RED" and they work
  • I have rewritten the code so not RED would be Black
  • Tried seeing if it composed properly even if preview was bad (didn't work)

 

However, no matter what I have done the code still shows black text on a dark colored background. Here is my code:

 

var tbl = [];
var myTable = new FPTable;
myTable.AddColumns(3000, 3000, 3000, 3000, 3000);

if (Field("RUN COLOR") == "RED")
{
   //Formatting the table
   for (var i=0; i<2; i++)
   {
       var row = myTable.AddRow();
       var cell = row.Cells[0];

       cell.Margins = new FPTableMargins;
       cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};

       //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
       cell.HAlign = "Right";
       cell.VAlign = "Bottom";
       cell.TextColor = "White";
       row.CopyCells(0,1,2,3,4);
       row.minHeight = 800;
   }
}
else
{
   //Formatting the table
   for (var i=0; i<2; i++)
   {
       var row = myTable.AddRow();
       var cell = row.Cells[0];

       cell.Margins = new FPTableMargins;
       cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};

       //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
       cell.HAlign = "Right";
       cell.VAlign = "Bottom";
       cell.TextColor = "Black";
       row.CopyCells(0,1,2,3,4);
       row.minHeight = 800;
   }
}

//Insert Data into Rows
myTable.Rows[0].SetContents("<color name=\"White\">" + Field("BOX09"), Field("BOX07"), Field("BOX05"), Field("BOX03"), Field("BOX01")); //Row 1
myTable.Rows[1].SetContents(Field("BOX10"), Field("BOX08"), Field("BOX06"), Field("BOX04"), Field("BOX02")); //Row 2

BoxSet = myTable.MakeTags().replace(/^\<table/, "<table alignment=right");

return BoxSet;

 

If it is helpful to know this code slightly varies from the other template that does work. Here is that code:

 

var tbl = [];
var myTable = new FPTable;
myTable.AddColumns(3100, 3100, 3100, 3100);

if (Field("RUN COLOR") == "RED")
{
   //Formatting the table
   for (var i=0; i<3; i++)
   {
       var row = myTable.AddRow();
       var cell = row.Cells[0];

       cell.Margins = new FPTableMargins;
       cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};

       //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
       cell.HAlign = "Right";
       cell.VAlign = "Bottom";
       cell.TextColor = "White";
       row.CopyCells(0,1,2,3);
       row.minHeight = 1200;
   }
}
else
{
   //Formatting the table
   for (var i=0; i<3; i++)
   {
       var row = myTable.AddRow();
       var cell = row.Cells[0];

       cell.Margins = new FPTableMargins;
       cell.Margins = {Bottom: 0, Top: 0, Left: 0, Right: 0};

       //cell.SetBorders("Thin", "Black", "Top", "Right", "Bottom", "Left");
       cell.HAlign = "Right";
       cell.VAlign = "Bottom";
       cell.TextColor = "Black";
       row.CopyCells(0,1,2,3);
       row.minHeight = 1200;
   }
}

//Insert Data into Rows
myTable.Rows[0].SetContents(Field("BOX10"), Field("BOX07"), Field("BOX04"), Field("BOX01")); //Row 1
myTable.Rows[1].SetContents(Field("BOX11"), Field("BOX08"), Field("BOX05"), Field("BOX02")); //Row 2
myTable.Rows[2].SetContents(Field("BOX12"), Field("BOX09"), Field("BOX06"), Field("BOX03")); //Row 3

BoxSet = myTable.MakeTags().replace(/^\<table/, "<table alignment=right");

return BoxSet;

 

If someone could just guide me to what is causing this issue of being black all the time regardless of the Rules or what is set in the Text Frame, I would appreciate it.

 

It may be possible I am just missing something small but it absolutely does not change to White if the background frame is Red.

Posted (edited)

The first question I always ask in situations like this is, are there any messages about colors in the composition log (.msg) file?

 

The next thing is, try looking at the actual tags generated. I would add this line right before the ending "return BoxSet" line:

Print(BoxSet);

Then look in the .msg file to see whether the tags look right.

Edited by Dan Korn
Posted
The first question I always ask in situations like this is, are there any messages about colors in the composition log (.msg) file?

 

I am not sure I understand the message in the box but I see this for all of the records and the only one not composing correctly are on Sheet #6

Composing record #54, input record 54
   Sheet #6, record #1
No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.

 

The next thing is, try looking at the actual tags generated. I would add this line right before the ending "return BoxSet" line:

Print(BoxSet);

Then look in the .msg file to see whether the tags look right.

 

This seems to help a bit more when compared to the other template that works the output code is identical. Here is the code snippet on the area that is still showing black:

Composing record #54, input record 54
   Sheet #6, record #1
No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.
<table alignment=right columns=5>

[sNIPPED]

<cell margins=Top:0;Bottom:0;Left:0;Right:0>
<p br=false quad="R"><p br=false cellalignment="Bottom">
<span><color name="White">125</span>

 

So yeah the tag definitely looks correct. This is the number that is showing up black when it needs to be white.

 

If you want I can always attach the .msg files if you think it will help.

Posted
I am not sure I understand the message in the box but I see this for all of the records and the only one not composing correctly are on Sheet #6

Composing record #54, input record 54
   Sheet #6, record #1
No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.

Well, that's not a message about colors. You probably have a call to FindGraphicFrame that's not actually setting a graphic in the frame. Anyway, that message is benign.

This seems to help a bit more when compared to the other template that works the output code is identical. Here is the code snippet on the area that is still showing black:

Composing record #54, input record 54
   Sheet #6, record #1
No value associated to graphic copyhole <SetGraphic_Temp_1> in record 54.
<table alignment=right columns=5>

[sNIPPED]

<cell margins=Top:0;Bottom:0;Left:0;Right:0>
<p br=false quad="R"><p br=false cellalignment="Bottom">
<span><color name="White">125</span>

 

So yeah the tag definitely looks correct. This is the number that is showing up black when it needs to be white.

That does seem like the correct tag. Are you sure that corresponds to the output? Could there be another table cell with the same number?

 

Perhaps you have tag such as <span color=Black> outside of the table, which is keeping the color fixed. I would try moving the table to another frame.

 

I would also try reducing the problem to a minimal example; for instance, does a simple table with a single cell have the same problem? If not, try adding the rest back in until you find what triggers it.

If you want I can always attach the .msg files if you think it will help.

Well, the log file is great, but I'm still looking at this through a keyhole. If you want to attach the collected job, I might be able to look at it.

Posted
That does seem like the correct tag. Are you sure that corresponds to the output? Could there be another table cell with the same number?

 

Perhaps you have tag such as <span color=Black> outside of the table, which is keeping the color fixed. I would try moving the table to another frame.

 

I would also try reducing the problem to a minimal example; for instance, does a simple table with a single cell have the same problem? If not, try adding the rest back in until you find what triggers it.

 

Well, the log file is great, but I'm still looking at this through a keyhole. If you want to attach the collected job, I might be able to look at it.

 

Dan, I wasn't sure what part would help you the best so I have attached the complete composition folder. I did find and correct the graphic frame issue.

 

I will try removing rows and cells to reduce the number of possibilities.

I have tried deleting and rebuilding the Text Frame without success.

1504112274.zip

Posted

added </span> to FORMAT_agency rule and it seems to give the results your looking for.

Leo

 

if (Field("RUN COLOR") == "RED")

{

return "<span color=\"White\">" + Field("AGENCY") + '</span>';

}

else

{

return Field("AGENCY");

}

Posted
added </span> to FORMAT_agency rule and it seems to give the results your looking for.

Leo

 

*facepalm*

I didn't even think to check to see that the other code was working properly.

 

Thanks! ^^,

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