4 Replies Latest reply on Apr 2, 2008 4:03 PM by (Tak_Osato)

    How to specify "Layout Grid" or "Margin/Column" for a new doc in the Japanese version

      I am using the Japanese version of InDesign CS2.

      When you open a new document in the Japanese version,
      you can specify what kind of layout grid to use
      "Layout Grid" (traditional Japanese layout) or
      "Margin/Column" (normal English layout).

      How do you specify this in scripting?

      Thanks in advance.
        • 1. Re: How to specify "Layout Grid" or "Margin/Column" for a new doc in the Japanese version
          function getLineAlignment(p_justification){
          var lineAlignment = 0;
          switch(p_justification){
          case 1818915700: //left justify
          lineAlignment = 1819047018;
          break;
          case 1818584692: //left
          lineAlignment = 1818324084;
          break;
          case 1667591796: //center
          lineAlignment = 1818321774;
          break;
          case 1919379572: //right
          lineAlignment = 1818325602;
          break;
          case 1667920756: //center justify
          lineAlignment = 1818455658;
          break;
          case 1919578996: //right justify
          lineAlignment = 1819435626;
          break;
          case 1718971500: //full justify
          lineAlignmentt = 1818651754;
          break;
          default: break;
          }
          return lineAlignment;
          }

          var myDoc;

          var gridProp = {
          appliedFont: pstyle.appliedFont,
          fontStyle: pstyle.appliedFont.fontFamily,
          pointSize: pstyle.pointSize,
          characterAki: pstyle.pointSize*pstyle.tracking/1000,
          lineAki: (pstyle.leading != Leading.auto? pstyle.leading: pstyle.autoLeading*pstyle.pointSize/100)- pstyle.pointSize,
          horizontalScale: pstyle.horizontalScale,
          verticalScale: pstyle.verticalScale,
          lineAlignment: getLineAlignment(pstyle.justification),
          gridAlignment: pstyle.gridAlignment,
          characterAlignment: pstyle.characterAlignment
          };

          var storyPref = {frameType: FrameTypes.frameGridType, storyOrientation: StoryHorizontalOrVertical.horizontal}; //textFrameType, vertical, unknown
          var marginPref = {columnCount: 2, columnGutter: 10*72/25.4, columnDirection: HorizontalOrVertical.horizontal, top: 5, bottom: 5, left: 5, right: 5};

          app.layoutGridData.properties = gridProp;
          app.storyGridData.properties = gridProp;

          jxswm
          • 2. Re: How to specify "Layout Grid" or "Margin/Column" for a new doc in the Japanese version
            Level 1
            jxswm,

            Thanks for your input. I read through your code, but
            I couldn't understand it. It may be that I wasn't
            clear in my question, and you gave me a code to do
            something else.

            After looking through all the available classes in
            detail, it seems that the only difference between a
            "Layout Grid" and "Margin/Column" type document
            is that the "Layout Grid" type has the
            following document properties set to true

            MyDocument.CJKGridPreferences.ShowAllLayoutGrids = True
            MyDocument.CJKGridPreferences.SnapToLayoutGrid = True

            By setting them to false, I was able to
            get the "Margin/Column" type document.

            Thank you.
            Tak
            • 3. Re: How to specify "Layout Grid" or "Margin/Column" for a new doc in the Japanese version
              Level 1
              this is help to set the cjk grid data.

              You code is just to show the cjk grid.

              But in practices, set the cjk grid is the common action.

              Yes, show just use gridPreferences and cjkGridPreferences.

              jxswm
              • 4. Re: How to specify "Layout Grid" or "Margin/Column" for a new doc in the Japanese version
                Level 1
                jxswm,

                Thanks for the clarification. Obviously, my question was
                so basic that you thought I wanted to know how to
                set up a cjk grid, not just turn in on or off.

                I will review your code if I need to set up a cjk grid.

                Thanks.
                Tak