Jump to content

JavaScript Table API – The Basics


Dan Korn

Recommended Posts

  • Replies 67
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Ste,

 

Thanks for the reply. You were correct in your assumption and I was able to resolve the validation issue. However now when I insert the rule into a text frame, all I see is the black shading from the first column. No other data is populating. Here's the code I'm using

 

new FPTable; 
var myTable = new FPTable
myTable.AddColumns(17000, 8107);
myTable.AddRows(6); 
myTable.Rows[0].Cells[0].Font="Times New Roman"; 
myTable.Rows[0].Cells[0].TextColor="White";
myTable.Rows[0].Cells[0].ShadeColor="Black"; 
myTable.Rows[0].Cells[0].ShadePct=100;
myTable.Rows[1].Cells[0].Font="Times New Roman"; 
myTable.Rows[1].Cells[0].TextColor="Black";
myTable.Rows[1].Cells[0].ShadeColor="White"; 
myTable.Rows[1].Cells[0].ShadePct=100;
myTable.Rows[1].CopyCells(0,1);

myTable.Rows[2].Cells[0].Font="Times New Roman"; 
myTable.Rows[2].Cells[0].TextColor="Black";
myTable.Rows[2].Cells[0].ShadeColor="White"; 
myTable.Rows[2].Cells[0].ShadePct=100;
myTable.Rows[2].CopyCells(0,1);
myTable.Rows[3].Cells[0].Font="Times New Roman"; 
myTable.Rows[3].Cells[0].TextColor="Black";
myTable.Rows[3].Cells[0].ShadeColor="White"; 
myTable.Rows[3].Cells[0].ShadePct=100;
myTable.Rows[3].CopyCells(0,1);
myTable.Rows[4].Cells[0].Font="Times New Roman"; 
myTable.Rows[4].Cells[0].TextColor="Black";
myTable.Rows[4].Cells[0].ShadeColor="White"; 
myTable.Rows[4].Cells[0].ShadePct=100;
myTable.Rows[4].CopyCells(0,1);
myTable.Rows[5].Cells[0].Font="Times New Roman"; 
myTable.Rows[5].Cells[0].TextColor="Black";
myTable.Rows[5].Cells[0].ShadeColor="White"; 
myTable.Rows[5].Cells[0].ShadePct=100;
myTable.Rows[5].CopyCells(0,1);

myTable.Rows[0].SetContents = ("Earnings", 'Company Paid");
myTable.Rows[1].SetContents = ("Shift Differential Pay Overtime", Field("ShiftDifferenceOT"));
myTable.Rows[2].SetContents = ("Shift Differential Pay", Field("ShiftDifference"));
myTable.Rows[3].SetContents = ("Overtime Pay", Field("OTPay"));
myTable.Rows[4].SetContents = ("Regular Earnings", Field("RegEarnings"));
myTable.Rows[5].SetContents = ("Gross Earnings", Field("GrossEarnings"));
return myTable.MakeTags();

 

Any thoughts as to what I'm missing here?

 

Thanks!

Link to comment
Share on other sites

Sure! Just remove the "=" between the SetContents function and its parameters:

myTable.Rows[0].SetContents("Earnings", [color="Red"]'[/color]Company Paid");
myTable.Rows[1].SetContents("Shift Differential Pay Overtime", Field("ShiftDifferenceOT"));
myTable.Rows[2].SetContents("Shift Differential Pay", Field("ShiftDifference"));
myTable.Rows[3].SetContents("Overtime Pay", Field("OTPay"));
myTable.Rows[4].SetContents("Regular Earnings", Field("RegEarnings"));
myTable.Rows[5].SetContents("Gross Earnings", Field("GrossEarnings"));
return myTable.MakeTags();

 

Btw, I think that apostrophe should be a quotation mark ;)

Link to comment
Share on other sites

myTable.Rows[0].SetContents [color=Red]= [/color]("Earnings", [color=Red]'[/color]Company Paid");
myTable.Rows[1].SetContents [color=Red]= [/color]("Shift Differential Pay Overtime", Field("ShiftDifferenceOT"));
myTable.Rows[2].SetContents [color=Red]= [/color]("Shift Differential Pay", Field("ShiftDifference"));
myTable.Rows[3].SetContents [color=Red]= [/color]("Overtime Pay", Field("OTPay"));
myTable.Rows[4].SetContents [color=Red]= [/color]("Regular Earnings", Field("RegEarnings"));
myTable.Rows[5].SetContents [color=Red]= [/color]("Gross Earnings", Field("GrossEarnings"));
return myTable.MakeTags();

Any thoughts as to what I'm missing here?

FPTable.SetContents is a function, so you don't want the equal sign after it. The last few lines should look like this:

myTable.Rows[0].SetContents("Earnings", "Company Paid");
myTable.Rows[1].SetContents("Shift Differential Pay Overtime", Field("ShiftDifferenceOT"));
myTable.Rows[2].SetContents("Shift Differential Pay", Field("ShiftDifference"));
myTable.Rows[3].SetContents("Overtime Pay", Field("OTPay"));
myTable.Rows[4].SetContents("Regular Earnings", Field("RegEarnings"));
myTable.Rows[5].SetContents("Gross Earnings", Field("GrossEarnings"));
return myTable.MakeTags();

Actually, you can reduce a lot of the other logic in the rule with some "for" loops as well. So the entire rule could be this:

var myTable = new FPTable
myTable.AddColumns(17000, 8107);
myTable.AddRows(6);

for (var row = 0; row < 6; row++)
{
   for (var cell = 0; cell < 2; cell++)
   {
       myTable.Rows[row].Cells[cell].Font = "Times New Roman"; 
       myTable.Rows[row].Cells[cell].TextColor = "Black";
       myTable.Rows[row].Cells[cell].ShadeColor = "White"; 
       myTable.Rows[row].Cells[cell].ShadePct = 100;
   }
}

// first cell has inverted colors
myTable.Rows[0].Cells[0].TextColor = "White";
myTable.Rows[0].Cells[0].ShadeColor = "Black"; 

myTable.Rows[0].SetContents("Earnings", "Company Paid");
myTable.Rows[1].SetContents("Shift Differential Pay Overtime", Field("ShiftDifferenceOT"));
myTable.Rows[2].SetContents("Shift Differential Pay", Field("ShiftDifference"));
myTable.Rows[3].SetContents("Overtime Pay", Field("OTPay"));
myTable.Rows[4].SetContents("Regular Earnings", Field("RegEarnings"));
myTable.Rows[5].SetContents("Gross Earnings", Field("GrossEarnings"));
return myTable.MakeTags();

Link to comment
Share on other sites

Woops! I didn't catch that when I posted the code here. :rolleyes:

I had it corrected when I copied the rule over into FP - but thanks for catching that!

 

I removed the "=" but now all I see when I preview this is the black fill in Column 1, Row, 1 - no content in either Column for Row 1.

I then see the content for Column 1, rows 2-6 but nothing in Column 2.:(

 

Ugh, I knew attacking this on my own was not a smart way to start the year!

Link to comment
Share on other sites

Woops! I didn't catch that when I posted the code here. :rolleyes:

I had it corrected when I copied the rule over into FP - but thanks for catching that!

 

I removed the "=" but now all I see when I preview this is the black fill in Column 1, Row, 1 - no content in either Column for Row 1.

I then see the content for Column 1, rows 2-6 but nothing in Column 2.:(

 

Ugh, I knew attacking this on my own was not a smart way to start the year!

Are you sure that those data fields have values for the record you're composing or previewing? What happens if you just use hard-coded data instead? Try this rule verbatim and see what you get:

var myTable = new FPTable
myTable.AddColumns(17000, 8107);
myTable.AddRows(6);

for (var row = 0; row < 6; row++)
{
   for (var cell = 0; cell < 2; cell++)
   {
       myTable.Rows[row].Cells[cell].Font = "Times New Roman"; 
       myTable.Rows[row].Cells[cell].TextColor = "Black";
       myTable.Rows[row].Cells[cell].ShadeColor = "White"; 
       myTable.Rows[row].Cells[cell].ShadePct = 100;
   }
}

// first cell has inverted colors
myTable.Rows[0].Cells[0].TextColor = "White";
myTable.Rows[0].Cells[0].ShadeColor = "Black"; 

myTable.Rows[0].SetContents("Earnings", "Company Paid");
myTable.Rows[1].SetContents("Shift Differential Pay Overtime", "ShiftDifferenceOT");
myTable.Rows[2].SetContents("Shift Differential Pay", "ShiftDifference");
myTable.Rows[3].SetContents("Overtime Pay", "OTPay");
myTable.Rows[4].SetContents("Regular Earnings", "RegEarnings");
myTable.Rows[5].SetContents("Gross Earnings", "GrossEarnings");
return myTable.MakeTags();

This shows the whole table, with all ten cells populated, for me. (I don't have your data file.)

 

Also, do a full composition (not a preview) and check for any warning messages in the log (.msg) file.

Link to comment
Share on other sites

  • 2 months later...
I am wondering if there is a way to surpress empty rows in a table. I am working on creating a letter that contains a table listing trades that have been completed on behalf of a client. Some clients have at most 23 trades while other clients have a single trade to list.
Link to comment
Share on other sites

I am wondering if there is a way to surpress empty rows in a table. I am working on creating a letter that contains a table listing trades that have been completed on behalf of a client. Some clients have at most 23 trades while other clients have a single trade to list.

Sure. As you're going through and building up the table with calls to FPTable.AddRow(), just don't add a row if there's nothing to populate it with. You may need to change the logic to call AddRow() inside of whatever loop you're using, instead of a single call to AddRows() with a hard-coded number.

Link to comment
Share on other sites

Below is the code that I am trying to use to populate my table but it keeps giving me an error. I am somewhat new to this javascript thing and do not understand what I am doing wrong. i copied the code from the previous thread and modified it as needed.

 

Is there and easier way to do this in the newest Fusion Pro?

 

new FPTable;

var myTable = new FPTable;

myTable.AddColumns (7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200) ;

myTable.AddRows (24) ;

 

myTable.Rows [0] .SetContents (Account, Buy/Sell, Security_Description, Trade_Date, Executed_Quantity, Execution_Price, Solicited, Discretion)

myTable.Rows [1] .SetContents (Field("Account 1"), Field("Buy/ sell1"), Field("Security description1"), Field("Trade date1"), Field("Executed quantity1"), Field("Execution price1"), Field("Solicited1"), Field("Discretion1"))

myTable.Rows [2] .SetContents (Field("Account 2"), Field("Buy/ sell2"), Field("Security description2"), Field("Trade date2"), Field("Executed quantity2"), Field("Execution price2"), Field("Solicited2"), Field("Discretion2"))

myTable.Rows [3] .SetContents (Field("Account 3"), Field("Buy/ sell3"), Field("Security description3"), Field("Trade date3"), Field("Executed quantity3"), Field("Execution price3"), Field("Solicited3"), Field("Discretion3"))

myTable.Rows [4] .SetContents (Field("Account 4"), Field("Buy/ sell4"), Field("Security description4"), Field("Trade date4"), Field("Executed quantity4"), Field("Execution price4"), Field("Solicited4"), Field("Discretion4"))

myTable.Rows [5] .SetContents (Field("Account 5"), Field("Buy/ sell5"), Field("Security description5"), Field("Trade date5"), Field("Executed quantity5"), Field("Execution price5"), Field("Solicited5"), Field("Discretion5"))

myTable.Rows [6] .SetContents (Field("Account 6"), Field("Buy/ sell6"), Field("Security description6"), Field("Trade date6"), Field("Executed quantity6"), Field("Execution price6"), Field("Solicited6"), Field("Discretion6"))

myTable.Rows [7] .SetContents (Field("Account 7"), Field("Buy/ sell7"), Field("Security description7"), Field("Trade date7"), Field("Executed quantity7"), Field("Execution price7"), Field("Solicited7"), Field("Discretion7"))

myTable.Rows [8] .SetContents (Field("Account 8"), Field("Buy/ sell8"), Field("Security description8"), Field("Trade date8"), Field("Executed quantity8"), Field("Execution price8"), Field("Solicited8"), Field("Discretion8"))

myTable.Rows [9] .SetContents (Field("Account 9"), Field("Buy/ sell9"), Field("Security description9"), Field("Trade date9"), Field("Executed quantity9"), Field("Execution price9"), Field("Solicited9"), Field("Discretion9"))

myTable.Rows [10] .SetContents (Field("Account 10"), Field("Buy/ sell10"), Field("Security description10"), Field("Trade date10"), Field("Executed quantity10"), Field("Execution price10"), Field("Solicited10"), Field("Discretion10"))

myTable.Rows [11] .SetContents (Field("Account 11"), Field("Buy/ sell11"), Field("Security description11"), Field("Trade date11"), Field("Executed quantity11"), Field("Execution price11"), Field("Solicited11"), Field("Discretion11"))

myTable.Rows [12] .SetContents (Field("Account 12"), Field("Buy/ sell12"), Field("Security description12"), Field("Trade date12"), Field("Executed quantity12"), Field("Execution price12"), Field("Solicited12"), Field("Discretion12"))

myTable.Rows [13] .SetContents (Field("Account 13"), Field("Buy/ sell13"), Field("Security description13"), Field("Trade date13"), Field("Executed quantity13"), Field("Execution price13"), Field("Solicited13"), Field("Discretion13"))

myTable.Rows [14] .SetContents (Field("Account 14"), Field("Buy/ sell14"), Field("Security description14"), Field("Trade date14"), Field("Executed quantity14"), Field("Execution price14"), Field("Solicited14"), Field("Discretion14"))

myTable.Rows [15] .SetContents (Field("Account 15"), Field("Buy/ sell15"), Field("Security description15"), Field("Trade date15"), Field("Executed quantity15"), Field("Execution price15"), Field("Solicited15"), Field("Discretion15"))

myTable.Rows [16] .SetContents (Field("Account 16"), Field("Buy/ sell16"), Field("Security description16"), Field("Trade date16"), Field("Executed quantity16"), Field("Execution price16"), Field("Solicited16"), Field("Discretion16"))

myTable.Rows [17] .SetContents (Field("Account 17"), Field("Buy/ sell16"), Field("Security description17"), Field("Trade date17"), Field("Executed quantity17"), Field("Execution price17"), Field("Solicited17"), Field("Discretion17"))

myTable.Rows [18] .SetContents (Field("Account 18"), Field("Buy/ sell17"), Field("Security description18"), Field("Trade date18"), Field("Executed quantity18"), Field("Execution price18"), Field("Solicited18"), Field("Discretion18"))

myTable.Rows [19] .SetContents (Field("Account 19"), Field("Buy/ sell18"), Field("Security description19"), Field("Trade date19"), Field("Executed quantity19"), Field("Execution price19"), Field("Solicited19"), Field("Discretion19"))

myTable.Rows [20] .SetContents (Field("Account 20"), Field("Buy/ sell19"), Field("Security description20"), Field("Trade date20"), Field("Executed quantity20"), Field("Execution price20"), Field("Solicited20"), Field("Discretion20"))

myTable.Rows [21] .SetContents (Field("Account 21"), Field("Buy/ sell20"), Field("Security description21"), Field("Trade date21"), Field("Executed quantity21"), Field("Execution price21"), Field("Solicited21"), Field("Discretion21"))

myTable.Rows [22] .SetContents (Field("Account 22"), Field("Buy/ sell22"), Field("Security description22"), Field("Trade date22"), Field("Executed quantity22"), Field("Execution price22"), Field("Solicited22"), Field("Discretion22"))

myTable.Rows [23] .SetContents (Field("Account 23"), Field("Buy/ sell23"), Field("Security description23"), Field("Trade date23"), Field("Executed quantity23"), Field("Execution price23"), Field("Solicited23"), Field("Discretion23"))

mytable.Rows [0] . Type = "Header";

return myTable.MakeTags();

Link to comment
Share on other sites

Below is the code that I am trying to use to populate my table but it keeps giving me an error. I am somewhat new to this javascript thing and do not understand what I am doing wrong. i copied the code from the previous thread and modified it as needed.

 

Is there and easier way to do this in the newest Fusion Pro?

 

new FPTable;

var myTable = new FPTable;

myTable.AddColumns (7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200) ;

myTable.AddRows (24) ;

 

myTable.Rows [0] .SetContents (Account, Buy/Sell, Security_Description, Trade_Date, Executed_Quantity, Execution_Price, Solicited, Discretion)

myTable.Rows [1] .SetContents (Field("Account 1"), Field("Buy/ sell1"), Field("Security description1"), Field("Trade date1"), Field("Executed quantity1"), Field("Execution price1"), Field("Solicited1"), Field("Discretion1"))

// ...<snip>...

myTable.Rows [23] .SetContents (Field("Account 23"), Field("Buy/ sell23"), Field("Security description23"), Field("Trade date23"), Field("Executed quantity23"), Field("Execution price23"), Field("Solicited23"), Field("Discretion23"))

mytable.Rows [0] . Type = "Header";

return myTable.MakeTags();

Oh my goodness! Yes, there is a much easier way to do all of that, with a simple "for" loop:

var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
   var row = myTable.AddRow();
   row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
}

return myTable.MakeTags();

I also assumed that the header row was meant to be set with literal strings (in quotes).

 

Basically, any time you have that kind of repetitive JavaScript code, you should be able use a loop of some kind, and generally, a "for" loop is best.

 

Now you should be able to see how you can just skip adding a row altogether if there's nothing to populate it with. I assume that the "Account" field is empty in this case. So this should do what you want:

var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
   if (!Field("Account " + r))
       continue; // don't add empty rows

   var row = myTable.AddRow();
   row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));
}

return myTable.MakeTags();

Link to comment
Share on other sites

Thanks for the help Dan, As always it is much appreciated. I got the code you provided to work but I tried to modify so that i could set the font type and size and broke the code. Can you tell me how or where I would add this information?
Link to comment
Share on other sites

Thanks for the help Dan, As always it is much appreciated. I got the code you provided to work but I tried to modify so that i could set the font type and size and broke the code. Can you tell me how or where I would add this information?

Sure, inside the "r" loop, after the call to AddRow, you can do something like this:

   for (var c = 0; c < myTable.Columns.length; c++)
   {
       row.Cells[c].Font = "Arial";
       row.Cells[c].PointSize = 12;
   }

Link to comment
Share on other sites

I have tried moving the addtional code around to everyplace i can possibly move it to and the font is staying the same size.

 

 

var myTable = new FPTable;

myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();

headerRow.Type = "Header";

headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)

{

if (!Field("Account " + r))

continue; // don't add empty rows

 

var row = myTable.AddRow();

row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));

}

for (var c = 0; c < myTable.Columns.length; c++)

{

row.Cells[c].Font = "Arial";

row.Cells[c].PointSize = 9;

}

return myTable.MakeTags();

Link to comment
Share on other sites

The "var c" loop has to be inside the "var r" loop, like so:

var myTable = new FPTable;
myTable.AddColumns(7200, 7200, 10800, 7200, 7200, 7200, 7200, 7200);

var headerRow = myTable.AddRow();
headerRow.Type = "Header";
headerRow.SetContents("Account", "Buy/Sell", "Security_Description", "Trade_Date", "Executed_Quantity", "Execution_Price", "Solicited", "Discretion");

for (var r = 1; r < 24; r++)
{
   if (!Field("Account " + r))
       continue; // don't add empty rows

   var row = myTable.AddRow();
   row.SetContents(Field("Account " + r), Field("Buy/ sell" + r), Field("Security description" + r), Field("Trade date" + r), Field("Executed quantity" + r), Field("Execution price" + r), Field("Solicited" + r), Field("Discretion" + r));

   for (var c = 0; c < myTable.Columns.length; c++)
   {
       row.Cells[c].Font = "Arial";
       row.Cells[c].PointSize = 9;
   }
}

return myTable.MakeTags();

When you validate the rule in the editor, what does it return? It should have some tags like <z newsize="9"> in it.

Link to comment
Share on other sites

Hi Dan,

 

I finally got the table code to work with your help. It is much appreciated. However i am now having trouble alinging the table within my document. i am attacheing my files. The PDF named template.pdf is my fusion pro template, the original letter is named Draft letter.pdf, my data is in the test.csv file and output is in Test-output.pdf.

 

I need to get my test-output.pdf file to resemble the layout in the Draft letter.pdf in that the table is cetered within the body of the letter. I have tried inserting my table rule and centering that but it does not appear to work. Is there a way to accomplish this easily within the settings for the table?

INGuser.zip

Link to comment
Share on other sites

Hi Dan,

 

I finally got the table code to work with your help. It is much appreciated. However i am now having trouble alinging the table within my document. i am attacheing my files. The PDF named template.pdf is my fusion pro template, the original letter is named Draft letter.pdf, my data is in the test.csv file and output is in Test-output.pdf.

 

I need to get my test-output.pdf file to resemble the layout in the Draft letter.pdf in that the table is cetered within the body of the letter. I have tried inserting my table rule and centering that but it does not appear to work. Is there a way to accomplish this easily within the settings for the table?

The answer is in post 9 in this same thread.

Link to comment
Share on other sites

Was messing with your table Amber, just to help teach me stuff and I got this far if you hadn't gotten anywhere.

 

var myTable = new FPTable;
myTable.AddColumns(15000, 15000, 15000); 

   var headerRow = myTable.AddRow();
   myTable.Rows[0].Cells[0].Font = "Arial";
   myTable.Rows[0].Cells[0].PointSize = 10;
   myTable.Rows[0].Cells[0].HAlign = "Center";
   myTable.Rows[0].Cells[0].SetBorders("Thin","Black","Bottom");
   myTable.Rows[0].Cells[0].Margins = new FPTableMargins;
   myTable.Rows[0].Cells[0].Margins.Top = 10;
   myTable.Rows[0].Cells[0].Margins.Bottom = 10;
   myTable.Rows[0].CopyCells(0,1,2);
   myTable.Rows[0].Cells[0].Content = "Original Issue Date";
   myTable.Rows[0].Cells[1].Content = "Payee Name";
   myTable.Rows[0].Cells[2].Content = "Check Amount";

   for (var r = 1; r < 57; r++)
{

   if (!Field("Original Issue Date" + r))
       continue; // don't add empty rows


   var row = myTable.AddRow();
   row.SetContents(Field("Original Issue Date" + r), Field("Payee Name" + r), Field("Check Amount" + r));

  for (var c = 0; c < myTable.Columns.length; c++)
   {
       row.Cells[c].Margins = new FPTableMargins;
       row.Cells[c].Margins.Top = 50;
       row.Cells[c].Margins.Bottom = 30;        
       row.Cells[c].Font = "Arial";
       row.Cells[c].PointSize = 8;
       row.Cells[c].HAlign = "Center";
       }    
}
return myTable.MakeTags();

Link to comment
Share on other sites

  • 3 weeks later...
So I have one more question on this job. The client is now asking if there is a way for me to output single pdf files and use the account number within the data file as the file name for each individual file. Please help as i think this may be doable with a Java rule but I am still in the beginning stages of learning Java.
Link to comment
Share on other sites

So I have one more question on this job. The client is now asking if there is a way for me to output single pdf files and use the account number within the data file as the file name for each individual file. Please help as i think this may be doable with a Java rule but I am still in the beginning stages of learning Java.

Please start a new thread with questions not related to the table API, to keep this thread on-topic. Thanks.

Link to comment
Share on other sites

  • 1 month later...

Is there an easy way to add a ShadePct to a border color? The code below applies a solid Pantone 3435 border to the top of the cell. It needs to be 40%.

 

table.Rows[1].Cells[0].SetBorders ("Thin", "Pantone 3435 U", "Top");

 

Discaimer: I was able to fake it by adding another row with the ShadePct set to 40 and fiddling with the cell's content. This seems like kind of a hack and I'm curious if there's a better way. Thanks.

Link to comment
Share on other sites

Is there an easy way to add a ShadePct to a border color? The code below applies a solid Pantone 3435 border to the top of the cell. It needs to be 40%.

 

table.Rows[1].Cells[0].SetBorders ("Thin", "Pantone 3435 U", "Top");

Discaimer: I was able to fake it by adding another row with the ShadePct set to 40 and fiddling with the cell's content. This seems like kind of a hack and I'm curious if there's a better way. Thanks.

No, sorry, there's no way to specify a shading percentage on a table border or cell, either with the JavaScript Table API or with tagging. You have to create a new color.

Link to comment
Share on other sites

  • 5 months later...
I have tried the "table.Rows[1].Cells[0].VAlign = "Top";

and it looks like there is no change in the page as contents are still centered in the cell.

Is there anything else we can do ?

It's hard to say without seeing more of the job. Maybe you have the wrong row or cell number. Maybe the text content in the cell has some <br> or <p> tags in it. It might depend on your Legacy Leading setting. There are too many things for me to guess at.

Link to comment
Share on other sites

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