Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adding a Page to section causes TOC error

Community Beginner ,
Sep 15, 2011 Sep 15, 2011

I have the following document with the section and page setup:

Front Cover - pg A  - Section : letters, start at 1 (A)

Inside Page - pg B

About Page - pg i - Section: roman numerals, start at 1 (i)

TOC page - pg ii

Desc Page - pg 1 - Section: arabic numbers, start at 1

Desc Other Page - pg 2

Inside Back Page - pg 3

Back Cover - pg C Section: letters, start  at 3 (c)

I got the following function in c#:

private static void AddPageToSection(Document doc, Page page, int pageStartNumber, idPageNumberStyle style)

{

   Section section = doc.Sections.Add(page);

   section.ContinueNumbering = false;

   section.PageStart = page;

   section.PageNumberStart = pageStartNumber;

   section.Style = style;

}

I have the following method calls:

AddPageToSection(doc, doc.Pages[1], 1, idPageNumberStyle.idLetters); // Cover page

AddPageToSection(doc, doc.Pages[3], 1, idPageNumberStyle.idRomanNumerals); // About page

AddPageToSection(doc, doc.Pages[5], 1, idPageNumberStyle.idArabicNumbers); // Desc page

AddPageToSection(doc, doc.Pages[5], 3, idPageNumberStyle.idLetters); // Back cover page

When I run the code, it throws the error when it tries to generate the toc:

document.CreateTOC(document.TOCStyles[1], true, book, Type.Missing, true, Type.Missing);

It works fine IF only the cover page is added to the section. If any other page is added to a section, it throws the error:

Error HRESULT E_FAIL has been returned from call to a COM component.

Why is this happening? Indessign is Desktop CS 5 with all patches installed. C# and .NET are both supported according to Indesign Documentation.

TOPICS
Scripting
997
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 16, 2011 Sep 16, 2011

I'm really amazed at Adobe. Customers have to pay thousands of dollars for BETA software (Indesign) and they don't even have a single support person on their forums to help resolve issues. Should've gone with professional tool like Quark or Page maker.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 10, 2013 Jan 10, 2013
LATEST

I might meet the same problem and spent a day to solve it, i use InDesign 5.5, some indesign files can use the createTOC, and some files just through error in javascript or HRESULT_FAIL in VB.NET, here is my code:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

var doc = app.open(myFiles, false); <--- you should set it to true

...

...

var myStorys = doc.createTOC(tocStyle, true, undefined, [myX1, myY1]);

the key point is when i open the document with false, the error will happen again with some files, but if this parameter set to true, it's just ok.

Too few information from support person to handle the problem... we have to try the script to solve the problem....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines