Hello, the html string is retrieved from the HtmlText method of the SfRichTextEditor component, I attach it as it is collected.
htmlstring = I attach it as it is collected.
using (WordDocument document = new WordDocument())
{
byte[] byteArray = Encoding.ASCII.GetBytes(htmlstring);
//Loads or opens an existing Word document from stream
Stream inputStream = new MemoryStream(byteArray);
//Loads or opens an existing Word document through Open method of WordDocument class
document.Open(inputStream, FormatType.Html);
//Creates an instance of memory stream
MemoryStream stream = new MemoryStream();
//Saves the document to stream
document.Save(stream, FormatType.Docx);
//Closes the document
document.Close();
//Save the stream as a file in the device and invoke it for viewing
Xamarin.Forms.DependencyService.Get<ISaveExport>().Save("HTMLtoWord.docx", "application/msword", stream);
Attachment:
HTML_df767493.zip