C#, OpenXML and replacing text in the document : I open document and copy to the stream.

How I can replace some text in document before stream?

            //wordTemplate  - var with path to my word template
            byte[] result = null;
            byte[] templateBytes = System.IO.File.ReadAllBytes(wordTemplate);
            using (MemoryStream templateStream = new MemoryStream())
            {
                templateStream.Write(templateBytes, 0, (int)templateBytes.Length);
                using (WordprocessingDocument doc = WordprocessingDocument.Open(templateStream, true))
                {
                    MainDocumentPart mainPart = doc.MainDocumentPart;

                    mainPart.Document.Save();
                    templateStream.Position = 0;
                    using (MemoryStream memoryStream = new MemoryStream())
                    {
                        templateStream.CopyTo(memoryStream);
                        result = memoryStream.ToArray();
                    }
                }
            }