Skip to main content
Inspiring
Aug 11, 2025 9:53 AM UTC
Answered

Setting Text to New Note (INoteDataUtils)

Hi,

I'm trying to create a new note in a text object. The note gets created successfully, and I'm also able to set the author without any issue.

However, when I try to create or access the ITextModel to set the text content of the note, it returns nil. I'm not sure what I'm missing here.

Any help or suggestions would be greatly appreciated.

Thanks!

        UIDRef storyRef = ::GetUIDRef(textModel);
        UIDRef newNoteRef = Utils<INoteDataUtils>()->NewNote(start,storyRef,documentRef);
        if(newNoteRef)
        {
            InterfacePtr<INoteData> noteData(newNoteRef, UseDefaultIID());
            ASSERT(noteData);
            if(noteData == nil) {
                break;
            }
            PMString AuthorName = "Chetan";
            WideString author(AuthorName);
            noteData->SetAuthor(author);

            InterfacePtr<ITextModel> noteTextModel(newNoteRef, IID_ITEXTMODEL);

 

Manan JoshiCorrect answer
Community Expert
Aug 11, 2025 10:12 AM UTC

kNoteDataBoss does not have ITextModel interface as much as I can see. You probably would have to look into ITextStoryThread or ITextStoryThreadDict interfaces to get to the textmodel

-Manan

-Manan

2 replies

Manan JoshiCommunity ExpertCorrect answer
Community Expert
Aug 11, 2025 10:12 AM UTC

kNoteDataBoss does not have ITextModel interface as much as I can see. You probably would have to look into ITextStoryThread or ITextStoryThreadDict interfaces to get to the textmodel

-Manan

Translate
-Manan
Chetan SAuthor
Inspiring
Aug 12, 2025 5:23 AM UTC

Thank you Manan for your help, I used FindNoteStoryThread and inserted text at threadStart,

Translate