Welcome to the Blazor feedback portal. We’re happy you’re here! If you have feedback on how to improve the Blazor, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
We are generating DocIO documents with a user defined-structure.
The structure (simplified) consists of 2 types:
- Part, these have 2 text contents, a 'Part A' and 'part B'. The user is allowed the edit the content of these 2 parts.
- Reference: references a different user-defined structure (which could in turn reference another user-defined structure ad infinitum.)
users are not allowed to change the content of these references. For this we use InlineContentControls with LockContentControl and LockContent both true.
Before and after the 'Part A', 'Part B' and reference we are including 'Start' and 'End' markers (small gray labels surrounded by square brackets).
These Start/End markers are for visualisation purpose, and the user is not allowed to edit these.
For this were using the same InlineContentControls as before (with LockContentControl and LockContent both true)
Together with the structure we add some metadata to the document using the document.Variables.
The structure and variables are saved and sent to the editor.
When the data (converted to a MemoryStream) reaches the editor,
the first thing we do is open the file using the DocIO library.
After opening the file, we extract the document.Variables to a variable for later use.
After which we dispose the DocIO document and reset the stream.
Now we open the file in the editor using the OpenAsync function.
The user is now free to edit all of the 'Part A' and 'Part B' contents or add additional text at the end of the file.
When the user is done editing the file, we save file through the editor, into a MemoryStream.
Now we open said stream as a DocIO document, and re-add the document.Variables we had previously stored away for later user.
The document is saved (as a DocIO document) again, and sent back to the server.
The user can, at a later point, re-open the file and start editing again (which would follow the above flow again. Open as DocIO, extract variables etc.)
However I noticed after saving the file through the editor, most of my InlineContentControls had been replaced with TextRanges.
A small amount of the InlineContentControls were still present.
After saving and re-opening the file again, I noticed the remaining InlineContentControls had now been replace by TextRanges aswell.
Because of this, the contents of both the reference objects and Part A/B can now be edited by the user.
Initialy the file had 10 InlineContentControls and 16 TextRanges.
After re-opening the file once, only 2 InlineControlControls were left, and the amount of TextRanges increased to 18.
After re-opening the file again, no InlineContentControls were left, and the amount of TextRanges decreased to 14.
Attached is a project with a simplified document structure.
When you open the project, it generates the structure and opens it in the editor.
After which you can save and re-open the file using the button in the topleft.
This saves the files in the editor, saves the resulting stream as a DocIO document and re-opens this DocIO document in the editor.
The file which is shown on startup works as expected, none of the grey elements can be altered/removed.
When the file is saved and reopened however, most of these elements can be altered/removed.
The editor clearly supports InlineContentControls, as all of them work the first time the document is opened, and some still work after the file has been re-opened.
However I would like for their behaviour (or rather, the editor's behaviour) to be more consistent and preferably for it NOT to replace them with TextRanges :)