How to achieve the edited multi-paragraph text to replace the original multi-paragraph text?

I want to get the multi-paragraph text contained in the curly braces in the word file, and add a space in front of each line of multi-paragraph text, I can currently get the multi-paragraph text contained in the curly brace, and have edited the multi-paragraph text, how to achieve the edited multi-paragraph text to replace the original multi-paragraph text?
this is my code,but return value reCount was always 0, which did not achieve my goal

string docText = doc.Sections[0].Document.GetText();
 MatchCollection matches = Regex.Matches(docText, @"\{([^}]*)\}");

 foreach (Match match in matches)
 {
     string matchText = match.Value;
     string innerText = matchText.Trim('{', '}').Replace("\r", "\n");
    string[] lines = innerText.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);

    string outText = "{\r";
     foreach (string line in lines)
     {
         outText += "    " + line + "\r";
   }
     outText += "}\r";
   FindReplaceOptions options = new FindReplaceOptions();
     options.MatchCase = false;
     options.FindWholeWordsOnly = false;
     int reCount = 0;
     reCount = doc.Sections[0].Document.Range.Replace(matchText, outText);
     reCount = doca.Sections[-].Document.Range.Replace(matchText, outText, options);
     doc.Save("out.docx");
}

@lovecomputer You can achieve this using IReplacingCallback. For example see the following code:

Document doc = new Document(@"C:\Temp\in.docx");
FindReplaceOptions opt = new FindReplaceOptions();
opt.ReplacingCallback = new MyReplacingCallback();
opt.Direction = FindReplaceDirection.Backward;
doc.Range.Replace(new Regex(@"\{[^\}]+\}"), "", opt);
doc.Save(@"C:\Temp\out.docx");
private class MyReplacingCallback : IReplacingCallback
{
    public ReplaceAction Replacing(ReplacingArgs args)
    {
        string value = args.Match.Value;
        // Replace paragraph breaks in the matched value with paragraph break + 4 spaces
        value = value.Replace("\xE00D", "&p    ").Replace("    }", "}");
        args.Replacement = value;
        return ReplaceAction.Replace;
    }
}

Here is the produced output: out.docx (64.7 KB)

In a paragraph, usually preceded by text and ended by a period and a hard return character(\r), my question is:
1 If there is a period at the end, how to use a regular way to remove the end of the period;
2 How to add a period at the end of a paragraph if there is no period at the end;
The first requirement example
The original paragraph: Test is paragraph。Test is very good。\r
Target paragraph: Test is paragraph。Test is very good。\r

The second requirement example
The original paragraph: Test is paragraph。Test is very good\r
Target paragraph: Test is paragraph。Test is very good。\r

@lovecomputer You can use code like the following to add a period at the end of paragraph if there is no period using find/replace functionality:

Document doc = new Document(@"C:\Temp\in.docx");
FindReplaceOptions opt = new FindReplaceOptions();
opt.UseSubstitutions = true;
doc.Range.Replace(new Regex(@"([^\.])&p"), "$1.&p", opt);
doc.Save(@"C:\Temp\out.docx");

You can use a similar approach to remove a period if required.

I have a text with multiple layers of curly braces, and I want to indent the content in each curly brace into 2 characters, 4 characters, 6 characters, etc. according to the level of curly braces, how can I achieve this?The attachment is my original format and target format
myfile.docx (12.5 KB)

@lovecomputer I am afraid there is no neither built-in nor simple way to achieve this using Aspose.Words. What you need is formatting code snippets in your document. This is out of Aspose.Words scope. You can get the required code from the document and then format it using some third-party tool For example see the following question on StackOverflow:
https://stackoverflow.com/questions/34759476/format-c-sharp-code-with-indents-programmatically

How to copy a multi-level list from another document to this document, for example, the name of the multi-level list of other documents is demo

@lovecomputer List items in MS Word documents are paragraphs with list properties applied. So you can use the same approach as for copying regular paragraphs to copy list items.
https://docs.aspose.com/words/net/insert-and-append-documents/#import-and-insert-nodes-manually

Hi Sir,after I read it, it didn’t work out,It would be nice to give me a sample code, thanks!
If I have a source file
with a multi-level list style demo1, how do I copy this multi-level list style demo1 to a new document?

@lovecomputer You should use CopyStylesFromTemplate method to copy styles from template into the destination document.