Hi Aspose team,
in attached project you can find code that is opening OneNote document, making text replacement and overwriting file. If you run it 2x there is problem.
After first run:
06.12.2021 11:25:10
Starting file: OneNoteText\OneNoteText.one
Original Text: Roadshow PPT Folder
New Text: Oliver Test Change
Original Text: Montag, 6. Dezember 2021
Original Text: 11:11
Original Text:
Original Text: Roadshow PPT Folder
New Text: Oliver Test Change
Saved file: OneNoteText\OneNoteText.one
06.12.2021 11:25:11
Duration in [ms]:998
After second run:
06.12.2021 11:25:19
Starting file: OneNoteText\OneNoteText.one
Error Message: Index and length must refer to a location within the string.
Parameter name: length
Error Stack Trace: at System.String.Substring(Int32 startIndex, Int32 length)
at .
(RichText
)
at .
()
at .
()
at .
()
at .
()
at .
()
at .
()
at .
()
at .
()
at ?.
(Stream
, Document
, LoadOptions
)
at Aspose.Note.Document…ctor(Stream inStream, LoadOptions loadOptions)
at Aspose.Note.Document…ctor(Stream inStream)
at AsposeOneNote.OneNote.UpdateText(String Filename) in C:_Projects\Bugs\Aspose\0\Aspose.Bugs\OneNote.cs:line 65
06.12.2021 11:25:19
Duration in [ms]:548
To repeat locally make copy of OneNoteText - Original.one and save it as a OneNoteText.one. Document OneNoteText - Damaged.one is file where one change is already done.
Thanks for help,
Oliver
OneNoteTextReplacement.zip (116.9 KB)