Admin
August 22nd, 2008, 08:23 AM
Copy and paste everything below this line:
// This rule counts the number of lines and, if the line count is greater than 10, decrease the leading
// To use this rule, ensure you check the box "Treat returned strings as tagged text.
function FormatLeadingByLineCount()
{
// first combine fields that are on the same line
// for checking empty lines below
var nameLine = Field("FirstName")+Field("LastName");
var cszLine = Field("City")+Field("State")+Field("Zip")+Field("Country");
linesArray =
[
nameLine, Field("Title1"), Field("Title2"), Field("Title3"),
Field("Address1"), Field("Address2"), cszLine,
Field("Phone1"), Field("Fax1"), Field("Phone2"),
Field("Email"), Field("www")
];
var linesCount = 0;
for (var i = 0 ; i < linesArray.length ; i++)
{
if (linesArray[i] != "")
{
linesCount++;
}
}
if (linesCount > 10)
{
return '<para style="(no style)" quad="C" leading="35" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" widows="2" kerning="true" hyphenate="true" skipifempty="false"><tracking newsize="0.000000"></para>';
}
else
{
return '<para style="(no style)" quad="C" leading="70" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" widows="2" kerning="true" hyphenate="true" skipifempty="false"><tracking newsize="0.000000"></para>';
}
}
return FormatLeadingByLineCount();
// This rule counts the number of lines and, if the line count is greater than 10, decrease the leading
// To use this rule, ensure you check the box "Treat returned strings as tagged text.
function FormatLeadingByLineCount()
{
// first combine fields that are on the same line
// for checking empty lines below
var nameLine = Field("FirstName")+Field("LastName");
var cszLine = Field("City")+Field("State")+Field("Zip")+Field("Country");
linesArray =
[
nameLine, Field("Title1"), Field("Title2"), Field("Title3"),
Field("Address1"), Field("Address2"), cszLine,
Field("Phone1"), Field("Fax1"), Field("Phone2"),
Field("Email"), Field("www")
];
var linesCount = 0;
for (var i = 0 ; i < linesArray.length ; i++)
{
if (linesArray[i] != "")
{
linesCount++;
}
}
if (linesCount > 10)
{
return '<para style="(no style)" quad="C" leading="35" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" widows="2" kerning="true" hyphenate="true" skipifempty="false"><tracking newsize="0.000000"></para>';
}
else
{
return '<para style="(no style)" quad="C" leading="70" findent="0" lindent="0" rindent="0" leadbefore="0" leadafter="0" widows="2" kerning="true" hyphenate="true" skipifempty="false"><tracking newsize="0.000000"></para>';
}
}
return FormatLeadingByLineCount();