Hi,
We are using Aspose.word 10.5.0.0. DLL to generating HTML of input word document.
In our application, there is requirement in which we have to upload a word document, convert this word to html, and display this html as rich text editor.
However, when we use ASPOSE to generated html of given input word document (which is combination of multiple images, table, or text) and then display this html in rich text editor it will post back our asp.net page multiple time.
we are calling aspose license in page Constructors .
public
AdminDocumentFragment() Aspose.Words.License license = new Aspose.Words.License();
{
license.SetLicense(Server.MapPath(@"~\Bin\AsposeLicense\Aspose.Total.lic"));
license =
null;
}
Please find below code that is used for getting html using Aspose or attached document, which we used as an input document
Aspose.Words.Document doc = new Aspose.Words.Document(filepath);
string htmlText = string.Empty;
string lStrImageFolder = string.Empty;
lStrImageFolder = FolderPath + "/" + ConfigurationManager.AppSettings["HTMLFileFolderName"].ToString();
string tempDir = Path.Combine(Server.MapPath(lStrImageFolder));
if (!Directory.Exists(tempDir))
Directory.CreateDirectory(tempDir);
Aspose.Words.Saving.HtmlSaveOptions saveOptions = new Aspose.Words.Saving.HtmlSaveOptions();
saveOptions.ImagesFolder = tempDir;
saveOptions.CssStyleSheetType = Aspose.Words.Saving.CssStyleSheetType.Embedded;
saveOptions.SaveFormat=SaveFormat.Html;
saveOptions.ImagesFolderAlias = ConfigurationManager.AppSettings["HTMLFileFolderName"].ToString();
MemoryStream htmlStream = new MemoryStream();
doc.Save(htmlStream, saveOptions);
htmlText = Encoding.UTF8.GetString(htmlStream.GetBuffer());
htmlStream.Close();
this.HTMLFilePath = FolderPath + "/" + ConfigurationManager.AppSettings["HTMLFileName"].ToString();
StreamWriter sr = new System.IO.StreamWriter(Server.MapPath(this.HTMLFilePath), false, Encoding.Default);
StringBuilder strStylePath = new StringBuilder();
strStylePath.Append(htmlText);
sr.Write(strStylePath.ToString());
sr.Close();
So please let us know if there is any way to resolve this issue.or what is the main problem.
Is it problem of Aspose. Word dll which refresh or post back the asp.net page.or any other issue.
Please let us know if any solution is possible. It is very helpful for us.
Thanks
Samanvay.