We need to transform a document doc to retrieve content in htm format. This word document contains merge filed. But we execute the following code during processing, format merge field on pert and spaces before the merge fiedl randomly.We need to transform a document doc to retrieve content in htm format. This word document contains merge filed. But we execute the following code during processing, format merge field on pert and spaces before the merge fiedl randomly.
MemoryStream lItmTemplate = new MemoryStream(aContenuBinaire);
MemoryStream lItm = new MemoryStream();
//Set license
Aspose.Words.
License license = new Aspose.Words.License();
license.SetLicense(
“Aspose.Total.lic”);
//lit le document
Aspose.Words.
Document lDoc = new Aspose.Words.Document(lItmTemplate);
//on enregistre au format html
Aspose.Words.Saving.
HtmlSaveOptions saveOptions = new Aspose.Words.Saving.HtmlSaveOptions(Aspose.Words.SaveFormat.Html);
saveOptions.ImagesFolderAlias =
Path.GetTempPath();
saveOptions.ExportImagesAsBase64 =
true;
lDoc.Save(lItm, saveOptions);
//on le lit
lItm.Seek(0,
SeekOrigin.Begin);
StreamReader lReader = new StreamReader(lItm);
string lOutputText = lReader.ReadToEnd();
lReader.Close();
//on renvoye le contenu sous forme de string contenant de l’html
return lOutputText;
We need to transform a document doc to retrieve content in htm format. This word document contains merge filed. But we execute the following code during processing, format merge field on pert and spaces before the merge fiedl randomly.We need to transform a document doc to retrieve content in htm format. This word document contains merge filed. But we execute the following code during processing, format merge field on pert and spaces before the merge fiedl randomly. Attached are two files requestedAttached are two files requested
MemoryStream lItmTemplate = new MemoryStream(aContenuBinaire);
MemoryStream lItm = new MemoryStream();
//Set license
Aspose.Words.
License license = new Aspose.Words.License();
license.SetLicense(
“Aspose.Total.lic”);
//lit le document
Aspose.Words.
Document lDoc = new Aspose.Words.Document(lItmTemplate);
//on enregistre au format html
Aspose.Words.Saving.
HtmlSaveOptions saveOptions = new Aspose.Words.Saving.HtmlSaveOptions(Aspose.Words.SaveFormat.Html);
saveOptions.ImagesFolderAlias =
Path.GetTempPath();
saveOptions.ExportImagesAsBase64 =
true;
lDoc.Save(lItm, saveOptions);
//on le lit
lItm.Seek(0,
SeekOrigin.Begin);
StreamReader lReader = new StreamReader(lItm);
string lOutputText = lReader.ReadToEnd();
lReader.Close();
//on renvoye le contenu sous forme de string contenant de l’html
return lOutputText;