Hi,
We are using Aspose. Word 10.5.0.0. DLL to generating HTML of input word document.
As per our application requirement, input word documents contains multiple type of table which are differentiated by its style Name. When we generated html of these input word document using ASPOSE we are able to view same table formatting in html preview of these document but we are not able to work on this html because we did not find any differentiation in html of these table. In html ,” class ” attribute is missing inside the
tag and we have to perform operation in table according to its style as per requirement so that we need style name of the table in HTML.
For Example: In attached document, there is a two table. In which one has “DemoStyle1” style and other has “DemoStyle2” style. When we generate html of this document (PFA) using ASPOSE then in design view we are able to view it formatted of the table as input document but in development, we need some differentiation in these table.
Please find the below code which we used for generating html for your reference.
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 in ASPOSE, Is there any way to get this style name as class attribute in HTML inside the
tag.
Please let us know if any solution or workaround is possible.
Thanks.