Конвертировать WordprocessingDocument после текста в формате PDF в base64 - PullRequest
0 голосов
/ 16 апреля 2020

Я редактирую шаблон документа Word, используя Open XML. Я преобразовываю все это в строку:

 string path = AppDomain.CurrentDomain.BaseDirectory.Substring(0, AppDomain.CurrentDomain.BaseDirectory.IndexOf("\\bin"));
            using (WordprocessingDocument doc =
                WordprocessingDocument.Open(path+"\\Templates\\test.docx", true))
            {

                doc.Clone("writeText.docx");
                string docText = null;
                //1. Copy all the file into a string
                using (StreamReader sr = new StreamReader(doc.MainDocumentPart.GetStream()))
                    docText = sr.ReadToEnd();

                //2. Use regular expression to replace all text
                Regex regexText = new Regex("{{id}}");
                docText = regexText.Replace(docText, "21212121");
}

И затем, после замены строк, я хочу преобразовать его в ptef bytearry или base64. Есть предложения?

...