Skip to main content
Inspiring
August 11, 2025
Answered

Setting Text to New Note (INoteDataUtils)

  • August 11, 2025
  • 1 reply
  • 173 views

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

 

Correct answer Manan Joshi

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

1 reply

Manan JoshiCommunity ExpertCorrect answer
Community Expert
August 11, 2025

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
Chetan SAuthor
Inspiring
August 12, 2025

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