1 Reply Latest reply on Jan 3, 2013 6:21 AM by Russ Ward

    facing issue while trying to add folder to book using FDK11

    nkchakri909
      hi12:26 PM
      hi, i m facing issue while trying to add folders to a .book. Here's what i have done.
      I have created a book

      bookName=F_StrCopyString((StringT)"E:\\Createbook\\input\\test.book");
      newbookId=F_ApiNewNamedObject(FV_SessionId,FO_Book,bookName);

      and added a chapter to it.

      StringT chapName=F_StrCopyString((StringT)"E:\\Createbook\\input\\b_cli.fm");
      elemId = F_ApiNewSeriesObject(newbookId,FO_BookComponent,0);
      F_ApiSetString(newbookId, elemId, FP_Name,chapName);
      if(F_StrLen(chapName)) {
      F_ApiDeallocateString(&chapName);
      }

      After adding the chapter , I am calling the following function to create part:

      F_ObjHandleT FM_InsertFolderComponentInBook ( F_ObjHandleT bookId, F_ObjHandleT parentId, StringT compName)
      {
      F_ObjHandleT partId;
      F_ElementLocT elemLoc;
      IntT fileCount = 1;

      if ( !parentId )
      parentId = F_ApiGetId ( FV_SessionId, bookId, FP_HighestLevelElement );
      elemLoc.parentId = parentId;
      elemLoc.childId = 0;
      elemLoc.offset = 0;
      partId= F_ApiNewBookComponentOfTypeInHierarchy ( bookId, compName, FV_BK_FOLDER, &elemLoc);
      return partId;
      }


      However, part is not getting generated as parentId is comming null. Can anyone please help me create folder component in a .book using FDK11?
      I am  facing this issue if i am scripting using FDK11 but in FDK 10,its running fine. Is this an FKD11 library issue or i am missing anything in the code.
      Kindly help.

      .