CSS styles on table, TR and TD elements are not applied on HTML import using .NET

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.

Hi Samanvay,

Thanks for your query. As you know, HTML format is really different and it does not support lot of things supported in Word.

Please follow the link to learn details about how Aspose.Words saves document in the HTML/XHTML formats:

Hi
Samanvay,


Thanks for your inquiry. Unfortunately, Aspose.Words does not support CSS styles applied on table, tr and td elements on HTML import. Your request has been linked to the appropriate issue. You will be notified as soon as this feature is supported. We apologize for your inconvenience.

Best Regards,

Hi

I hope you’re doing well. Are you able to reproduce
the problem at your end? Did you get any solution for this? It would be great
help; if you provide the solution as soon as possible.

or can you provide me any workaround to fix this problem

Thanks
Samanvay.

Hi Samanvay,

I have verified this issue from our issue tracking system and like to share with you that this issue is not resolved yet. We will update you via this forum thread once this issue is resolved.

We appreciate your patience.

The issues you have found earlier (filed as WORDSNET-3163) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(84)

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan