Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library > Tables & Charts

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #61  
Old January 26th, 2015, 01:56 PM
dreimer dreimer is offline
Senior Contributor
 
Join Date: Oct 2010
Location: Shakopee, MN
Posts: 473
Default Re: JavaScript Table API – The Basics

Oh interesting didn't know they were reversed. Good to know.

And my main problem was Top and Bottom go in 10ths and Left and Right go in 100ths

Thanks.
__________________
Don Reimer - JavaScript Novice

MAC OS 10.13.6 Acrobat DC FP Creator 10.1.11
Windows 7 Acrobat X 10.1.4 FP Creator 9.3.9
Reply With Quote
  #62  
Old November 3rd, 2016, 01:34 PM
DSweet's Avatar
DSweet DSweet is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Oberlin, Ohio
Posts: 240
Default Re: JavaScript Table API – The Basics

It's been too long for this thread to not have something in it so...I have the following simple code which just loops through a set amount of iterations to create a generic table. Everything worked fine until I wanted to add the colors to the rows to make it look like GreenBar paper. Yea I know I'm really dating my age here, but oh well. I took the coding Dan placed earlier
Code:
myTable.ShadingColor1 = "Blue";
myTable.ShadingPct1 = 20;
myTable.ShadingRepeat1 = 1;
myTable.ShadingColor2 = "Red";
myTable.ShadingPct2 = 40;
myTable.ShadingRepeat2 = 1;
myTable.ShadingType = "ByRows";
and I placed it in my table rule
Code:
var tableRows = 10;

var colHead1 = 'Record';
var colHead2 = 'First Name in Stack';
var colHead3 = 'Record';
var colHead4 = 'Last Name in Stack';
var colHead5 = 'Print File Name';

var myTable = new FPTable;
myTable.ShadingColor1 = "Blue";
myTable.ShadingPct1 = 20;
myTable.ShadingRepeat1 = 1;
myTable.ShadingColor2 = "Red";
myTable.ShadingPct2 = 40;
myTable.ShadingRepeat2 = 1;
myTable.ShadingType = "ByRows";
myTable.AddColumns(10800, 10800, 10800, 10800, 10800);
myTable.AddRow();

myTable.Rows[0].Cells[0].Margins = new FPTableMargins;
myTable.Rows[0].Cells[0].Margins.Top = 23;
myTable.Rows[0].Cells[0].Margins.Bottom = 23;
myTable.Rows[0].Cells[0].Margins.Right = 10;
myTable.Rows[0].Cells[0].Margins.Left = 10;
myTable.Rows[0].Cells[0].Font="PNCSans";
myTable.Rows[0].Cells[0].PointSize=9.5;
myTable.Rows[0].Cells[0].VAlign = "Middle"
myTable.Rows[0].CopyCells(0, 1, 2, 3, 4);
myTable.Rows[0].SetContents(colHead1, colHead2, colHead3, colHead4, colHead5);
myTable.Rows[0].Type = "Header";


for ( var a = 1; a <= tableRows; a++)  {
    myTable.AddRow();
    myTable.Rows[a].Cells[0].Margins = new FPTableMargins;
    myTable.Rows[a].Cells[0].Margins.Top = 23;
    myTable.Rows[a].Cells[0].Margins.Bottom = 23;
    myTable.Rows[a].Cells[0].Margins.Right = 100;
    myTable.Rows[a].Cells[0].Margins.Left = 10;
    myTable.Rows[a].Cells[0].Font="PNCSans";
    myTable.Rows[a].Cells[0].PointSize=8.4;
    myTable.Rows[a].Cells[0].VAlign = "Middle"
    myTable.Rows[a].CopyCells(0, 1, 2, 3, 4);
    myTable.Rows[a].Cells[0].Content = "Record 1-"+a;
    myTable.Rows[a].Cells[1].Content = "First Name 1-"+a;
    myTable.Rows[a].Cells[2].Content = "Record 2-"+a;
    myTable.Rows[a].Cells[3].Content = "First Name 2-"+a;
    myTable.Rows[a].Cells[4].Content = "Print File_"+a;
}

return myTable.MakeTags();
However no matter where I place the code section for the color (I've tried at the front as shown above, I've tried placing it in front of and after the "myTable.AddRow();" statements, I've tried placing it at the end before the "MakeTags()" statement) each time I get a blank table. The contents of each cell are correct, but no color. Am I missing something? Where does the color coding come in to the programming scheme?
__________________
David A. Sweet
Variable Data Specialist
HKM Direct Market Communications
Windows 7, Acrobat 10.x
FusionPro Desktop and Server 10.0.26
Reply With Quote
  #63  
Old November 3rd, 2016, 01:59 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by DSweet View Post
Code:
var tableRows = 10;

var colHead1 = 'Record';
var colHead2 = 'First Name in Stack';
var colHead3 = 'Record';
var colHead4 = 'Last Name in Stack';
var colHead5 = 'Print File Name';

var myTable = new FPTable;
myTable.ShadingColor1 = "Blue";
myTable.ShadingPct1 = 20;
myTable.ShadingRepeat1 = 1;
myTable.ShadingColor2 = "Red";
myTable.ShadingPct2 = 40;
myTable.ShadingRepeat2 = 1;
myTable.ShadingType = "ByRow";
myTable.AddColumns(10800, 10800, 10800, 10800, 10800);
myTable.AddRow();

myTable.Rows[0].Cells[0].Margins = new FPTableMargins;
myTable.Rows[0].Cells[0].Margins.Top = 23;
myTable.Rows[0].Cells[0].Margins.Bottom = 23;
myTable.Rows[0].Cells[0].Margins.Right = 10;
myTable.Rows[0].Cells[0].Margins.Left = 10;
myTable.Rows[0].Cells[0].Font="PNCSans";
myTable.Rows[0].Cells[0].PointSize=9.5;
myTable.Rows[0].Cells[0].VAlign = "Middle"
myTable.Rows[0].CopyCells(0, 1, 2, 3, 4);
myTable.Rows[0].SetContents(colHead1, colHead2, colHead3, colHead4, colHead5);
myTable.Rows[0].Type = "Header";


for ( var a = 1; a <= tableRows; a++)  {
    myTable.AddRow();
    myTable.Rows[a].Cells[0].Margins = new FPTableMargins;
    myTable.Rows[a].Cells[0].Margins.Top = 23;
    myTable.Rows[a].Cells[0].Margins.Bottom = 23;
    myTable.Rows[a].Cells[0].Margins.Right = 100;
    myTable.Rows[a].Cells[0].Margins.Left = 10;
    myTable.Rows[a].Cells[0].Font="PNCSans";
    myTable.Rows[a].Cells[0].PointSize=8.4;
    myTable.Rows[a].Cells[0].VAlign = "Middle"
    myTable.Rows[a].CopyCells(0, 1, 2, 3, 4);
    myTable.Rows[a].Cells[0].Content = "Record 1-"+a;
    myTable.Rows[a].Cells[1].Content = "First Name 1-"+a;
    myTable.Rows[a].Cells[2].Content = "Record 2-"+a;
    myTable.Rows[a].Cells[3].Content = "First Name 2-"+a;
    myTable.Rows[a].Cells[4].Content = "Print File_"+a;
}

return myTable.MakeTags();
You just need to change it to "ByRow" instead of "ByRows".
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #64  
Old November 4th, 2016, 07:21 AM
DSweet's Avatar
DSweet DSweet is offline
Senior Contributor
 
Join Date: Sep 2008
Location: Oberlin, Ohio
Posts: 240
Default Re: JavaScript Table API – The Basics

Thanks Step. I really thought I had "copy and pasted" it. Not quite sure as to why it came out differently. Guess my mind is slipping.

Thanks again.
.
__________________
David A. Sweet
Variable Data Specialist
HKM Direct Market Communications
Windows 7, Acrobat 10.x
FusionPro Desktop and Server 10.0.26
Reply With Quote
  #65  
Old May 4th, 2017, 10:55 AM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by MikeA View Post
Hello all,

I'm hoping someone can point me in the right direction. Like the previous poster, I'm having an issue with the VAlign property of FPTable. I have a rule in which I create a table and set it to align cell content to center, both horizontally and vertically. This works if I call the rule as the first item in a text box. But if there is anything at all, even just a carriage return, above the rule, the content of the cells floats to the top. Everything else looks to be following the rule.

Here is the rule:
Code:
new FPTable;
var myTable = new FPTable;
myTable.AddColumns(16000, 6000, 6000, 6000, 6000, 6000);

// Add the top row
var topRow = myTable.AddRow();
    topRow.Cells[0].HAlign = "Center";
    topRow.Cells[0].VAlign = "Middle";
    topRow.Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Right", "Left");
    topRow.Cells[0].Font="Times New Roman";
    topRow.Cells[0].PointSize=11;    
    topRow.Cells[0].Bold="On";
    topRow.CopyCells(0,1,2,3,4,5);
    topRow.SetContents("Your Monthly Amount", "$100", "$250", "$500", "$1,000", "$5,000");

// Add the bottom row
var bottomRow = myTable.AddRow();
    bottomRow.Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Right", "Left");
    bottomRow.Cells[0].ShadeColor="Black";
    bottomRow.Cells[0].ShadePct=15;
    bottomRow.Cells[0].Font="Times New Roman";
    bottomRow.Cells[0].PointSize=11;
    bottomRow.Cells[0].Bold="On";    
    bottomRow.CopyCells(0,1,2,3,4,5);
    bottomRow.SetContents("Our Offer To You", "100", "250", "500", "1000", "5000");

// Center the table in the text box
return myTable.MakeTags().replace(/^\<table/, "<table alignment=center");
Using FP VDP Creator 8.2.7. I've attached a sample job for perusal. I cannot seem to figure this one out.

Thanks!
I understand this is a relatively old post, but I've been battling this bug all week and thought I'd share another workaround. I've noticed in the past that toggling "use legacy line leading" will sometimes remedy the issue (as previously noted in this thread) but I'm still unclear as to why that is. Furthermore, I think FusionPro has begun to rework the way it handles leading – so relying on "legacy" leading as a workaround did not sit well with me.

While thumbing through the section on tables in the TagsRefGuide, I noticed a "space" attribute and found that if you define space above (or below) the table, all of the cells magically become centered again:
Code:
var myTable = new FPTable;
myTable.AddColumns(16000, 6000, 6000, 6000, 6000, 6000);

// Add the top row
var topRow = myTable.AddRow();
    topRow.Cells[0].HAlign = "Center";
    topRow.Cells[0].VAlign = "Middle";
    topRow.Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Right", "Left");
    topRow.Cells[0].Font="Times New Roman";
    topRow.Cells[0].PointSize=11;    
    topRow.Cells[0].Bold="On";
    topRow.CopyCells(0,1,2,3,4,5);
    topRow.SetContents("Your Monthly Amount", "$100", "$250", "$500", "$1,000", "$5,000");

// Add the bottom row
var bottomRow = myTable.AddRow();
    bottomRow.Cells[0].SetBorders("Thin", "Black", "Top", "Bottom", "Right", "Left");
    bottomRow.Cells[0].ShadeColor="Black";
    bottomRow.Cells[0].ShadePct=15;
    bottomRow.Cells[0].Font="Times New Roman";
    bottomRow.Cells[0].PointSize=11;
    bottomRow.Cells[0].Bold="On";    
    bottomRow.CopyCells(0,1,2,3,4,5);
    bottomRow.SetContents("Our Offer To You", "100", "250", "500", "1000", "5000");
// Center the table in the text box
return myTable.MakeTags().replace(/^\<table/, '<table space="above:1" alignment=center');
If you actually want to add space above/below the table, then it's worth mentioning that the value should be in 10ths of a point but any value greater than 0 fixes the alignment issue. More info can be found on page 56 of the TagsRefGuide.pdf
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
  #66  
Old May 4th, 2017, 11:33 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,381
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by step View Post
Furthermore, I think FusionPro has begun to rework the way it handles leading
Yes, in FusionPro 9.3.36 and later, you can specify the leading mode as 9.3 on the Global Paragraph Settings dialog, which improves several issues like this regarding text layout in tables.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
  #67  
Old June 1st, 2017, 09:43 AM
sdavenport sdavenport is offline
Junior Community Member
 
Join Date: Sep 2008
Location: Cleveland, Ohio
Posts: 24
Default Re: JavaScript Table API – The Basics

What is the proper tag for assigning a Title to a table?
__________________
Windows 10 - FusionPro 10.0.26; Acrobat DC;

Steve Davenport
Variable Communications
Reply With Quote
  #68  
Old June 1st, 2017, 10:48 AM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,381
Default Re: JavaScript Table API – The Basics

Quote:
Originally Posted by sdavenport View Post
What is the proper tag for assigning a Title to a table?
It's the <title> tag, as documented in the FusionPro Tags Reference. But there's no corresponding property in the JavaScript table API, because, quite frankly, it's just as easy to put the title in the text frame before the rule that builds the table.
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

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)});
Reply With Quote
Reply

Tags
javascript, tables

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:51 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.