Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146296 | Jul 30,2019 09:15 AM UTC | Sep 12,2019 10:36 AM UTC | React - EJ 2 | 11 |
![]() |
Tags: DocumentEditor |
//Register Syncfusion license
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR LICENSE KEY"); |
WordDocument document = new WordDocument(stream, Syncfusion.DocIO.FormatType.Docx);
Stream stream1 = new MemoryStream();
document.MailMerge.RemoveEmptyGroup = true;
string[] fieldNames = new string[] { "FirstName" };
string[] fieldValues = new string[] { "Its after replacing" };
//Execute mail merge
document.MailMerge.Execute(fieldNames, fieldValues);
document.Save(stream1, Syncfusion.DocIO.FormatType.Docx);
string sfdtText = "";
EJ2WordDocument document = EJ2WordDocument.Load(stream1, Syncfusion.EJ2.DocumentEditor.FormatType.Docx);
sfdtText = Newtonsoft.Json.JsonConvert.SerializeObject(document);
document.Dispose();
// Open the return string in DocumentEditor open method
return sfdtText; |
Can we convert Document to pure HTML. So, that I can use this HTMLto send in Email body with the same format.
|
Yes, you can convert the document to pure HTML using Syncfusion DocIO library. Then pass the converted html to email body.
Client side in below sample code check exportAsHtml method:
Server side sample code:
For your convenienet we have prepared sample, kindly check it in below link:
| |
Can we load the document from json string. |
In backend, it is not possible to convert the json string to document.
In client side, using saveAsBlob you can convert the save the document as Docx option and get is as a blob stream and then pass that stream to server. Then proceed further for your requirement.
Open the sfdt in DocumentEditor using open method and then save it using saveAsBlob method.
Sample link:
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.