3 Replies Latest reply: Apr 22, 2013 8:51 AM by RonXyzzy RSS

    body -> Master page

    RonXyzzy

      In framemaker FDK, how does one associate the body page to a master page? please send code snippet.

        • 1. Re: body -> Master page
          Bob Niland (Error 7103) Community Member

          Do you know how this works in normal unstructured FM authoring?

           

          I don't know FDK, but your problem may be that the objects you need don't exist, because they don't exist by default in a fresh (not a template) FM document until the first time you perform the following operation:

           

          Format > Page Layout > Apply Master Pages ...

          | Master Page Mapping table does not exist.

          | A new table will be created in the reference pages.

          [ OK ]

           

          And the table thus created may be found via:

          View > Reference Pages

          MasterPageMaps

          but doesn't do anything until you populate it with para tag names, MP page names, and page span specs.

           

          At that point, the author can cause the mapping to occur in a couple of ways, one of which is:

          Format > Page Layout > Apply Master Pages ...

          (or AMP, as it is sometimes called here)

           

          I suspect there's an easy way to invoke an AMP in FDK.

          As to whether FDK can create that Master Page and table, and populate the table, dunno.

          • 2. Re: body -> Master page
            Wiedenmaier Community Member

            A body page is represented as "FO_BodyPage" object. You have to write code to get this object (objectid).

            FO_BodyPage has a property "MasterpageName". Set this property to the name of the masterpage you want to assign. I think using the alread mentioned APM functionality is the more general way and fit several other problems. To call this you have to get the fcode of the command "APPLYMASTERPAGES" (F_ApiGetNamedObject(FV_SessionId, FO_Command, "APPLYMASTERPAGES"). A command has an Fcode property which you can use to call F_ApiFcodes to execute this command by the FDK. I think the FDK reference will deliver more information. Bye Markus

            • 3. Re: body -> Master page
              RonXyzzy Community Member

              After reading throught the manual (not much help) and a lot of trial and error, here is a snippet of the code that works.

              The Master Page of a Body Page can be found in the Body Page Properties.  If the Master Page propety content is NULL, the the Body Page is NOT associated with a Master Page.

               

               

              ////////////////////////////////////////////////////////////////////////////////

              IntT MasterPage(F_ObjHandleT docId, F_ObjHandleT pageId)

              ////////////////////////////////////////////////////////////////////////////////

              {

                  UIntT i    = 0;

                  IntT blank = 0;

                  F_PropValsT props = F_ApiGetProps(docId, pageId);

                  for(i=0U; i < props.len; ++i)

                  {

                      if ((FP_MasterPage == props.val[i].propIdent.num) &&

                          (FT_String     == props.val[i].propVal.valType))

                      {

                          #ifdef DEBUG

                          F_Printf(NULL, "    i=%u  ident=%d %s valType=%d  Value=%s", i,

                                  props.val[i].propIdent.num,

                                  props.val[i].propIdent.name,

                                  props.val[i].propVal.valType,

                                  props.val[i].propVal.u.sval);

                          #endif

                          if (0 == props.val[i].propVal.u.sval) // None

                          {

                              ++blank; // No Master Page

                              F_Printf(NULL, "NO Master Page\n");

                          }

                          else

                          {

                              F_Printf(NULL, "Master Page is %s\n",

                                      props.val[i].propVal.u.sval);

                          }

                          break;

                      }

                  }

                  F_ApiDeallocatePropVals(&props);

                  return blank;

              }