Problem while displaying converted word HTML in rich text editor

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.

Hi Samanvay,


Thanks for your inquiry. After an initial test with Aspose.Words v11.1.0, I was unable to reproduce this issue on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.1.0. I hope, this will help.

Moreover, when developing an ASP.NET application, you can call License.SetLicense from the Global.asax.cs file, in the Application_Start protected method. It is called once when the application starts. Do not call License.SetLicense from within the class constructor since it means the license will be loaded every time a web page is loaded or posted back.

If we can help you with anything else, please feel free to ask.

Best Regards,