You can try to study this example and adapt it for your case
Alternative solution is store all the text and after cut the part with split function