Copy link to clipboard
Copied
We need to set section prefix string and marker string from our code. What we have been doing so far (CS19 SDK for InDesign 2024 and CS18SDK for InDesign 2023) was simply getting the necessary parameters to the ISectionCmdData::set() from ISection getters and setting them along with our personal section prefix string and the marker string. Our code is attached below (Please note that this code has few hardcoded values to improve the readability and testability -). But since CS20 SDK for InDesign 2025, we noticed that this ISectionCmdData::set() modifies section start page number back to one (If our section starting page number is set to 10 for example, after calling ISectionCmdData::set() 10 becomes 1). Is there a way to mitigate this issue?
Example:
In below doc and code we have set the starting page number of the 3rd section on the 7th document page(relative to very first document page) to be 10. But when we go to right cleck menu and apply current page number from "Insert special character-> Markers" page number has set to 1, even it's showing as 10 in the "Numbering and section options" dialog (After the code execution)
IDocument* iDocument = Utils<ILayoutUIUtils>()->GetFrontDocument();
IDataBase* myDatabaseforDocument = ::GetDataBase((IPMUnknown*)iDocument);
const UIDRef myDocID(::GetUIDRef(iDocument));
InterfacePtr<IPageList> myPageList(myDocID, UseDefaultIID());
const UID pageUID = myPageList->GetNthPageUID(7);
UIDRef pageUIDRef(myDatabaseforDocument, pageUID);
IDataBase* pageDB = pageUIDRef.GetDataBase(); if (pageDB == nil) {((void)0); break; }
InterfacePtr<ISectionList> mySectionList(myPageList, UseDefaultIID());
ISection* mySection = mySectionList->QueryNthSection(2);
const UID mySectionID = mySectionList->GetNthSectionUID(2);
ClassID myStyleProvider;
mySection->GetStyleInfo(&myStyleProvider);
bool16 myContinueFromPrevSection = mySection->GetContinueFromPrevSection();
bool16 myIncludePrefix = mySection->GetPageNumberIncludeSectionPrefix();
int32 myOffsetFromPrevSection = mySection->GetOffsetFromPrevSection();
int32 myStartPageNumber = mySection->GetStartPageNumber();
const UID myStartPageUID(mySection->GetStartPageUID());
InterfacePtr<ICommand> myCmd(CmdUtils::CreateCommand(kModifySectionSettingsCmdBoss)); if(myCmd == nil) { ((void)0); break; }
InterfacePtr<ISectionCmdData> myCmdData(myCmd, IID_ISECTIONCMDDATA); if(myCmdData == nil) { ((void)0); break; }
PMString mySectionPrefixString("Test1");
PMString myMarkerString("Test2");
myCmdData->Set(UIDRef(pageDB, pageDB->GetRootUID()),
myStartPageUID,
myStartPageNumber,
&mySectionPrefixString,
&myMarkerString,
myStyleProvider,
myContinueFromPrevSection,
myOffsetFromPrevSection);
myCmdData->SetPageNumberIncludeSectionPrefix(myIncludePrefix);
myCmd->SetItemList(UIDList(myDatabaseforDocument, mySectionID));
myCmd->SetUndoability(ICommand::kAutoUndo);
ErrorCode myResult = CmdUtils::ProcessCommand(myCmd);
2 Correct answers
This issue was submitted to Adobe and they suggested calling following functions, just before calling "ISectionCmdData->Set" as a workaround, for the time being.
InterfacePtr<IIntData> nonHiddenPageNumStart(myCmd, IID_INONHIDDENPAGENUMDATA);
nonHiddenPageNumStart->Set(myStartPageNumber);
A potential fix has been identified and will be available in the upcoming 20.2 release so developers don't have to implement the workaround @Kasun_Bamu pointed out :
InterfacePtr<IIntData> nonHiddenPageNumStart(myCmd, IID_INONHIDDENPAGENUMDATA);
nonHiddenPageNumStart->Set(myStartPageNumber);
Copy link to clipboard
Copied
If you think it's a bug in latest v20 SDK, it'll be worth logging a bug via InDesign developers prerelease program https://www.adobeprerelease.com/beta/D1A76A97-F7DC-4552-DE3C-FF5F211C7492
Copy link to clipboard
Copied
This issue was submitted to Adobe and they suggested calling following functions, just before calling "ISectionCmdData->Set" as a workaround, for the time being.
InterfacePtr<IIntData> nonHiddenPageNumStart(myCmd, IID_INONHIDDENPAGENUMDATA);
nonHiddenPageNumStart->Set(myStartPageNumber);
Copy link to clipboard
Copied
A potential fix has been identified and will be available in the upcoming 20.2 release so developers don't have to implement the workaround @Kasun_Bamu pointed out :
InterfacePtr<IIntData> nonHiddenPageNumStart(myCmd, IID_INONHIDDENPAGENUMDATA);
nonHiddenPageNumStart->Set(myStartPageNumber);

