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

ISectionCmdData::set() function is resetting the section starting page numbers InDesign 2025 SDK v20

Explorer ,
Jan 15, 2025 Jan 15, 2025

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)

Screenshot 2025-01-15 134337.pngexpand image

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);

 

TOPICS
Bug , SDK
208
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

correct answers 2 Correct answers

Explorer , Feb 03, 2025 Feb 03, 2025

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);
Translate
Adobe Employee , Feb 05, 2025 Feb 05, 2025

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);

 

Translate
New Here ,
Jan 17, 2025 Jan 17, 2025

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

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
Explorer ,
Feb 03, 2025 Feb 03, 2025

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);
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
Adobe Employee ,
Feb 05, 2025 Feb 05, 2025
LATEST

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);

 

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