0

There is a file with 61 fields on the input. It looks like this:

:61:230413D15546178,2S10349677328//6391965194
GOD/
:61:230413C333000,S202102674830882//6388156197
NCCMM/RTRN FNDS
:61:230413C952168,99S202PTCN2S2300288441//6391858000
RFND B/O 
:61:230413C6000000,S103WSLID234C0005TYZ//6390105971
:61:230413C17120000,S202102674833140//6391866680
NCCBBMM/RTRN FNDS

The output should be formatted text and written to docx

        61: Statement Line 
            Value  Entr F Code Reference                      Amount        Ma 
            230406        S103 49636932                         #20,#       D 
                               6359058720 
            230406        S103 49637251                         #10,#       D 
                               6359083606 
            230406        S103 49637055                         #10,#       D 
                               6359058833 
            230406        S103 49636292                         #10,#       D 
                               6358231853 
            230406        S103 49636207                         #30,#       D 
                               6358387897 
            230406        S103 49636423                         #50,#       D 
                               GOD/ 
            230406        S103 49630932                    #1070079,28#     D 
                               6358895735 
                               STR/ 
            230406        S103 MTT230415KO77055            #1245400,#       C 
                               6355807094 
            230406        S202 102064702221               #163443050,#       C 
                               6358276861 
                               NCCTTBMM/RTRN FNDS 

I created a template that has the keyword "TES2608T", I replace it with values that start with :61: Here is the code

bool foundLineWith61 = false;
if (line.StartsWith(":61:"))
{   
linesWith61.Add(line);
replacements.Add(line.Substring(line.IndexOf(":61:") + 4));
foundLineWith61 = true;
}

for (int i = 0; i < linesWith61.Count; i++)
{
string allReplacements = string.Join("\r\n", replacements.Select(x => $"{x}"));
ReplaceText(doc, "TES2608T", allReplacements,true);
}

And on the way out, it's final result idk how to display it correctly

Shak
  • 1
  • 1

0 Answers0