Working with Boxes
QXML for box
Box is represented by the <qx-page> node. It contains the following attributes:
|
Attribute |
Value |
Description |
|
|
|
number |
Unique ID of the box as generated by QuarkXPress |
|
|
|
text |
Name of the box |
|
|
|
|
Specifies what exactly does the box hold eg. Pictures, Text |
|
|
|
Specifies that content of box is 'text'. |
||
|
|
Specifies that content of box is 'picture'. |
||
|
|
text |
Name of Item Style applied on box |
|
Create new box
To create a new box:
-
Get the DOM of the active layout.
-
Create a new
<qx-box>element. -
Set the
box-content-typeattribute in the<qx-box>element. -
Set the
qxLeft,qxRight,qxTop and qxBottomstyling properties in the<qx-box>element. -
Set the
qxPagestyling property in the<qx-box>element. -
Append the
<qx-box>element as a child of the<qx-spread>node.
Sample JavaScript:
var layout=app.activeLayoutDOM();
var newBox = document.createElement("qx-box"); newBox.setAttribute("box-content-type", "text");
newBox.style.qxLeft = "0.5in";
newBox.style.qxRight = "4in";
newBox.style.qxTop = "6in";
newBox.style.qxBottom = "8in";
newBox.style.qxPage = 1;
var pages=layout.getElementsByTagName('qx-page')[0];
pages.parentNode.appendChild(newBox);
Delete existing box
To delete an existing box:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node corresponding to the spread to be deleted. -
Remove the
<qx-box>child node from the<qx-spread>node.
Sample JavaScript:
var layout = app.activeLayoutDOM();
var spread=layout.getElementsByTagName('qx-spread')[0];
var box = spread.getElementsByTagName('qx-box')[0];
spread.removeChild(box);
Apply box borders
Border width
To apply a border width:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in';
Border style
To apply a border style:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderStylestyling property to'dotted'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderStyle='dotted';
Border color
To apply a border color:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderColorstyling property to'yellow'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderColor='yellow';
Border shade
To apply a border shade:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderShadestyling property to'0.2'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderShade='0.2';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Border opacity
To apply border opacity:
-
Get the DOM of te active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderOpacitystyling property to'0.7'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderOpacity='0.7';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Border mix blend mode
To apply a border mix blend mode:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderMixBlendModestyling property to'darken'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderMixBlendMode='darken';
Border gap color
To apply a border gap color:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderStylestyling property to'dotted'. -
Set the
qxBorderGapColorstyling property to'cyan'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderStyle='dotted'; box.style.qxBorderGapColor='cyan';
Border gap shade
To apply a border gap shade:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderStylestyling property to'dotted'. -
Set the
qxBorderGapColorstyling property to'cyan'. -
Set the
qxBorderGapShadestyling property to'0.6'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderStyle='dotted'; box.style.qxBorderGapColor='cyan'; box.style.qxBorderGapShade='0.6';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Border gap opacity
To apply a border gap opacity:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderStylestyling property to'dotted'. -
Set the
qxBorderGapColorstyling property to'cyan'. -
Set the
qxBorderGapOpacitystyling property to'0.4'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderStyle='dotted'; box.style.qxBorderGapColor='cyan'; box.style.qxBorderGapOpacity='0.4';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Border gap mix blend mode
To apply a border gap mix blend mode:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBorderWidthstyling property to'0.1in'. -
Set the
qxBorderStylestyling property to'dotted'. -
Set the
qxBorderGapColorstyling property to'cyan'. -
Set the
qxBorderGapMixBlendModestyling property to'lighten'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBorderWidth='0.1in'; box.style.qxBorderStyle='dotted'; box.style.qxBorderGapColor='cyan'; box.style.qxBorderGapMixBlendMode='lighten';
Apply background color, shade and opacity
Background color
To apply a background color:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBackgroundColorstyling property to'cyan'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBackgroundColor='cyan';
Background shade
To apply background shade:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBackgroundColorstyling property to'cyan'. -
Set the
qxBackgroundShadestyling property to'0.8'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBackgroundColor='cyan'; box.style.qxBackgroundShade='0.8';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Background opacity
To apply background opacity:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxBackgroundColorstyling property to'cyan'. -
Set the
qxBackgroundOpacitystyling property to'0.3'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxBackgroundColor='cyan'; box.style.qxBackgroundOpacity='0.3';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Specify box position
To specify box position:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxTopstyling property to'3in'. -
Set the
qxBottomstyling property to'8in'. -
Set the
qxLeftstyling property to'3in'. -
Set the
qxRightstyling property to'7in'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxTop='3in'; box.style.qxBottom='8in'; box.style.qxLeft='3in'; box.style.qxRight='7in';
Apply runaround
To apply runaround:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxWrapFlowstyling property to'both'. -
Set the
qxWrapMarginTopstyling property to'5pt'. -
Set the
qxWrapMarginBottomstyling property to'5pt'. -
Set the
qxWrapMarginLeftstyling property to'5pt'. -
Set the
qxWrapMarginRightstyling property to'5pt'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxWrapFlow='both'; box.style.qxWrapMarginTop='5pt'; box.style.qxWrapMarginBottom='5pt'; box.style.qxWrapMarginLeft='5pt'; box.style.qxWrapMarginRight='5pt';
Apply drop shadow
Shadow color
To apply shadow color:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowColorstyling property to'magenta'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowColor='magenta';
Shadow shade
To apply shadow shade:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowShadestyling property to'0.7'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowShade='0.7';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Shadow opacity
To apply shadow opacity:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowOpacitystyling property to'0.5'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowOpacity='0.5';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Shadow distance
To apply shadow distance:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowDistancestyling property to'0.9in'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowDistance='0.9in';
Shadow angle synchronized
To apply shadow angle synchronized:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowAngleSynchronizedstyling property to'true'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowAngleSynchronized='true';
Shadow multiply
To apply shadow multiply:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowMultiplystyling property to'false'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowMultiply='false';
Shadow runaround
To apply shadow runaround:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowRunaroundstyling property to'true'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowRunaround='true';
Shadow inherit opacity
To apply shadow inherit opacity:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowInheritOpacitystyling property to'true'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowInheritOpacity='true';
Shadow transform
To apply shadow transform:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowTransformstyling property to'rotate(20deg) skew(40deg)'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowTransform='rotate(20deg) skew(40deg)';
Shadow knockOut
To apply shadow knockOut:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowKnockOutstyling property to'true'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowKnockOut='true';
Shadow filter
To apply shadow filter:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxShadowFilterstyling property to'blur(0.1in)'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxShadowFilter='blur(0.1in)';
Apply angle and skew
To apply angle and skew:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxTransformstyling property to'rotate(10deg) skew(30deg)'.var layout = app.activeLayoutDOM(); var box= layout.getElementsByTagName('qx-box')[0]; box.style.qxTransform='rotate(10deg) skew(30deg)';
Apply column properties
Column count
To apply column count:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2';
Column gap
To apply column gap:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnGapstyling property to'0.3in'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnGap='0.3in';
Column rule width
To apply column rule width:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnRuleWidthstyling property to'4pt'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnRuleWidth='4pt';
Column rule style
T apply column rule style:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnRuleStylestyling property to'dotted'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnRuleStyle='dotted';
Column rule color
To apply column rule color:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnRuleColorstyling property to'cyan'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnRuleColor='cyan';
Column rule shade
To apply column rule shade:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnRuleShadestyling property to'0.7'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnRuleShade='0.7';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Column rule opacity
To apply column rule opacity:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxColumnCountstyling property to'2'. -
Set the
qxColumnRuleShadestyling property to'0.3'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxColumnCount='2'; boxes.style.qxColumnRuleOpacity='0.3';Can be specified in the 0 - 1 range (0=0% and 1 = 100%).
Example values: 0 = 0%, 0.25 = 25%, 0.50 = 50% and 1 = 100%.
Apply padding
Inset text on All edges
To apply Inset Text on All edges:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxPaddingstyling property to'2pt'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxPadding='2pt';
Inset text on top,bottom,left,right edges
To apply inset text on top,bottom,left,right edges:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
qxPaddingTopstyling property to'5pt'. -
Set the
qxPaddingBottomstyling property to'7pt'. -
Set the
qxPaddingLeftstyling property to'10pt'. -
Set the
qxPaddingRightstyling property to'12pt'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxPaddingTop='5pt'; boxes.style.qxPaddingBottom='7pt'; boxes.style.qxPaddingLeft='10pt'; boxes.style.qxPaddingRight='12pt';
Apply mix blend mode
To apply mix blend mode:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxMixBlendMode'darken'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxMixBlendMode='darken';
Apply maintain aspect ratio
To apply maintain aspect ratio:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxMaintainAspectRatio'true'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxMaintainAspectRatio='true';
Apply suppress output for box
To apply suppress output for box:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxSuppressOutput'true'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxSuppressOutput='true';
Apply Text properties
Text transform
To apply text transform:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxTextTransform'rotate(40deg)'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxTextTransform='rotate(40deg)';
Text mix blend mode
To apply text mix blend mode:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxTextMixBlendMode'lighten'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxTextMixBlendMode='lighten';
Text flip horizontal
To apply text flip horizontal:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxTextFlipHorizontal'true'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxTextFlipHorizontal='true';
Text flip vertical
To apply text flip vertical are:-
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxTextFlipVertical'true'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxTextFlipVertical='true';
Apply first baseline minimum
To apply first baseline minimum are:-
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxFirstBaselineMinimum'ascent'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxFirstBaselineMinimum='ascent';
Apply first baseline offset
To apply first baseline offset are:-
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxFirstBaselineOffset'0.5in'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxFirstBaselineOffset='0.5in';
Apply align items
To apply align items:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxAlignItems'justify'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxAlignItems='justify';
Apply inter para max space
To apply inter para max space:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxAlignItems'justify'. -
Set the
styling property toqxInterParaMaxSpace'0.25in'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxAlignItems='justify'; boxes.style.qxInterParaMaxSpace='0.25in';
Apply run text around all sides
To apply run text around all sides:
-
Get the DOM of the active layout.
-
Get the
<qx-box>node . -
Set the
styling property toqxRunTextAroundAllSides'true'.var layout=app.activeLayoutDOM(); var boxes=layout.getElementsByTagName('qx-box')[0]; boxes.style.qxRunTextAroundAllSides='true';