7 Replies Latest reply on Aug 26, 2008 10:19 AM by (Sal_Mares)

    XML Vertical Bottom Column Alignment

      I'm currently working on a phone directory project with Indseign CS3 using the XML import function. I nearly have the project completed; one last issue that I have encountered is the vertical column alignment of the XML records. I have an XML layout that is cloned through the Indesign CS3 import options. The XML layout ends with the Address XML tag. That is were Im have the issue, I cant get the record to align vertically at the bottom of the columns. I want the Address XML tag to be the last line on each column. I know that Indesign CS3 knows to clone each record meaning that when its cloning the records, there is a starting and ending point for each record before it inserts the next record.
        • 1. Re: XML Vertical Bottom Column Alignment
          Goto Text Frame Options -

          Make the Vertical Justification of your template to Align Justify -

          Play with the Paragraph Spacing Limit until the last Address Line for that column fits -

          Each column should fit the same until the end - you will have to come up with something creative to not manually manipulate that part.
          • 2. Re: XML Vertical Bottom Column Alignment
            Level 1
            I have 50,000 records that are being imported through the xml file. I have tried the Text Frame Options in past, I have had no luck with the vertical alignment. My other question would be how do I define that the XML records as one set of data. When I created the xml layout template I made it very simple in Inches 8X10, .5 margins all around, 4 columns, 6 xml element tags with place holder text. The XML is then layed out and Paragraph styled with a little placeholder text. When I import I use the Clone option because every record in the XML structure is the same but with different data. It looks beautiful when I'm laying it out, but when I look at closely I notice that in some columns the XML record has split up and that some of data to the XML record is on the next column. I can't have the XML record split up at the bottom of the column, because it's a name, fax and the address information. The record needs to stay together at the bottom of the column, plus it has to vertically align across the four columns of the template. This has become a nightmare trying to figure out. Please help!!
            • 3. Re: XML Vertical Bottom Column Alignment
              srakete Level 1
              There is a script by Martin Fischer called vertikalerKeil_xl.js that I believe is doing what you need.
              Stefan
              • 4. Re: XML Vertical Bottom Column Alignment
                Level 1
                Stefan,

                I looked up Martin Fischer but can't seem to find the script. It sounds very intresting I would like to view the code.

                Thanks

                Sal Mares
                • 5. Re: XML Vertical Bottom Column Alignment
                  srakete Level 1
                  if (app.selection.length > 0) {
                  // Schleife für mehrere Objekte
                  for (myObject = 0; myObject < app.selection.length; myObject++){
                  // ist das Objekt ein Textrahmen
                  if (app.selection[0].constructor.name == "TextFrame"){
                  var mySpace = 0;
                  var myFrame = app.selection[myObject];
                  var myPs = myFrame.paragraphs;

                  // untere Textrahmenkante

                  myPage = app.activeWindow.activePage;
                  myDoc = app.documents[0];

                  // Wenn die untere Textrahmenkante über dem unteren Seitenrand liegt, dann ist diese die Bezugslinie zum Austreiben
                  if ((myFrame.geometricBounds[2] < myDoc.documentPreferences.pageHeight - myPage.marginPreferences.bottom) )
                  {
                  var myBottom = myFrame.geometricBounds[2];
                  }
                  // Wenn die untere Textrahmenkante auf dem unteren Seitenrand oder darunter liegt,
                  // dann ist der untere Seitenrand die Bezugslinie zum Austreiben
                  else
                  {
                  var myBottom = myDoc.documentPreferences.pageHeight - myPage.marginPreferences.bottom;
                  }

                  // Grundlinie letzte Zeile
                  var myBaseline = myFrame.lines[-1].characters[-1].baseline;
                  var myDiff = myBottom - myBaseline;

                  // Addition der Abstände VOR den Absätzen
                  // der Abstand des ersten Absatzes wird nicht berücksichtigt
                  for (oneP = 1; oneP < myPs.length; oneP++){
                  mySpace += myPs[oneP].spaceBefore
                  }

                  // Addition der Abstände NACH den Absätzen
                  // der Abstand des letzten Absatzes wird nicht berücksichtigt
                  for (oneP = 0; oneP < myPs.length-1; oneP++){
                  mySpace += myPs[oneP].spaceAfter
                  }

                  if (myDiff*-1 > mySpace)
                  {
                  alert("Zu wenig Raum, um den Text einzubringen.");
                  exit();
                  }
                  // Berechnung des Zuschlagfaktors
                  var myFactor = myDiff/mySpace

                  // Proportionale Verteilung des zu verteilenden Raums auf die Abstände VOR den Absätzen
                  // erweitert wird nur dort, wo bereits Abstand drin ist
                  // der Abstand des ersten Absatzes wird nicht berücksichtigt
                  for (oneP = 1; oneP < myPs.length; oneP++){
                  if (myPs[oneP].spaceBefore > 0){
                  myPs[oneP].spaceBefore += myPs[oneP].spaceBefore*myFactor
                  }
                  }
                  // Proportionale Verteilung des zu verteilenden Raums auf die Abstände NACH den Absätzen
                  // erweitert wird nur dort, wo bereits Abstand drin ist
                  // der Abstand des letzten Absatzes wird nicht berücksichtigt
                  for (oneP = 0; oneP < myPs.length-1; oneP++){
                  if (myPs[oneP].spaceAfter > 0){
                  myPs[oneP].spaceAfter += myPs[oneP].spaceAfter*myFactor
                  }
                  }
                  }
                  else {
                  alert("Fehler \nKeinen Textrahmen erwischt, \nsondern (in english) \"" + app.selection[0].constructor.name + "\"!")
                  }
                  }
                  }
                  else {
                  alert("Bitte einen Textrahmen auswählen?")
                  }
                  • 6. Re: XML Vertical Bottom Column Alignment
                    Level 1
                    Stefan,

                    I need a few more details about Script on how Martin Fischer is using it. All your help is really appreciated.
                    • 7. Re: XML Vertical Bottom Column Alignment
                      Level 1
                      Martin Fischer are you out there. I really need some advice.

                      Thanks

                      Sal Mares