Hi All,

I am having problem in deleting empty pages from each chapter.

Whenever I delete a large chunk of data from a chapter, the empty pages
that are left behind don't get deleted.

I have set the pagination settings for the book as following:
1) 1st Page Side = Read from File
2) Before Saving & Printing = Make Page Count Even (because I want to
have an empty page after each chapter)

But this setting works for some chapters (i.e empty pages get deleted)
but for some chapters it does not work instead it shows a pop window
asking the following question:

"The new column layout in csr.fm seems to overlap other objects on
some body pages.
Are you sure you want to do this?
Number of body pages affected:7. First page:38"

If I click on OK nothing happens (i.e empty pages don't get deleted)

I tried to solve this problem by writing a script also which works like

I will add a text as "Lastpage" on the whenever we finish writing a
chapter.. Then, we will find that text and loop through the pages after that
page and delete those empty pages.

For example,
My chapter has 10 pages
I have a text "Lastpage" inserted in page 7
Pages 9-10 should get automatically deleted from the chapter (Page 8

If the text "Lastpage"  is in page 8, pages 9-10 should get
automatically deleted from the chapter

I have written the following script in trying to fix this:

Set CurrentDoc = ActiveDoc;

New StringList NewVar(bPageNos);
New Integer NewVar(currPageNo);
New Integer NewVar(lastPageNo);

Loop ForEach(BodyPage) In(CurrentDoc) LoopVar(oPage)
  //Loop thru all the body pages in a chapter and store their page numbers
in the stringlist
     Add Member(oPage.pagenum) To(bPageNos);
     set lastPageNo = bPageNos.count;
     write lastPageNo;

New String NewVar(bpBodyPage);

//Find the text "Lastpage that I inserted on the page at which the chapter
Find FromTextLoc String('Lastpage') ReturnRange(trange) ReturnStatus

   If stat = true
//get the page number where it finds the text "Lastpage"
        set currPageNo = CurrentPage.pagenum;
        Write currPageNo;
        write lastPageNo;
//Loop from the page where it found the text "Lastpage" till the last page
in the chapter
     Loop While(i <= lastPageNo) LoopVar(i) Init(currPageNo+1) Incr(1)
                  write lastPageNo;
//Get the body page for each page that we loop thru and delete that page
        Get Object Type(BodyPage) Name(oPage) DocObject(CurrentDoc)
        write lPage;
        Delete Object(lPage);

But I am getting the following error:
"OBJ(NULL)" error
on the following line of the code: Get Object Type(BodyPage) Name(oPage)

Please suggest a workaround to this solution.

Ranvijay Chandel
Information Developer
Yantra Solutions Pvt. Ltd.
Bangalore (India)

Reply via email to