Copy link to clipboard
Copied
Hello,
This seems like a basic question but I couldn't find the answer yet:
I would like to use the integer value of a parameter to set the value of a paragraph formating parameter (here: number of allowed orphan lines)
Here is what my element looks like in the EDD:
Element (Container): Para
General rule: <TEXT> | etc...
Attribute list
Name: orphan_lines Integer Optional
Range: from 1 to 999
Default: 1
Text format rules
In all contexts.
Pagination properties
Widow/orphan lines: orphan_lines
Nevertheless this doesn't work: the parameter "Window Orphan Lines" from Parafraph Designer doesn't get set to the value value of "orphan_lines"
Is the syntax I'm using correct ?
Thanx in advance
Best regards
Eric
Hi Eric,
You can't reference an attribute value that way. It seems logical, but it's unfortunately not that flexible. You would need to reference the value in context rules in a more explicit manner, such as:
...unless somebody knows some syntax that I am forgetting. It's been a while since I wrote EDDs. Hope this helps.
Russ
[edit] Postscript... with this method, you probably would want to make the attribute a Choice type, so you can limit the values to only those supported by the context rules
...An alternative to Russ's EDD approach would be to use ExtendScript. Here is a snippet that illustrates the basic concept:
var doc, element, attrValue, pgf;
// Assuming you have doc, element, and pgf objects in scope...
// ...
attrValue = getAttributeValue (element, "orphan_lines");
if ((attrValue) && (attrValue !== "")) {
pgf.BlockLines = attrValue;
}
function getAttributeValue (element, name) {
var attrList = element.Attributes, i = 0;
for (i = 0; i < attrList.length;
...
Copy link to clipboard
Copied
Hi Eric,
You can't reference an attribute value that way. It seems logical, but it's unfortunately not that flexible. You would need to reference the value in context rules in a more explicit manner, such as:
...unless somebody knows some syntax that I am forgetting. It's been a while since I wrote EDDs. Hope this helps.
Russ
[edit] Postscript... with this method, you probably would want to make the attribute a Choice type, so you can limit the values to only those supported by the context rules you specify.
Copy link to clipboard
Copied
Thanx a lot for your answer !
Copy link to clipboard
Copied
An alternative to Russ's EDD approach would be to use ExtendScript. Here is a snippet that illustrates the basic concept:
var doc, element, attrValue, pgf;
// Assuming you have doc, element, and pgf objects in scope...
// ...
attrValue = getAttributeValue (element, "orphan_lines");
if ((attrValue) && (attrValue !== "")) {
pgf.BlockLines = attrValue;
}
function getAttributeValue (element, name) {
var attrList = element.Attributes, i = 0;
for (i = 0; i < attrList.length; i += 1) {
if (attrList[i].name === name) {
if (attrList[i].values[0] !== undefined) {
return (attrList[i].values[0]);
}
}
}
}