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, idPageNumberStyle.idLetters); // Cover page
AddPageToSection(doc, doc.Pages, 1, idPageNumberStyle.idRomanNumerals); // About page
AddPageToSection(doc, doc.Pages, 1, idPageNumberStyle.idArabicNumbers); // Desc page
AddPageToSection(doc, doc.Pages, 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, 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.
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.
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
var doc = app.open(myFiles[i], 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....