Free Support Forum - aspose.com

How to preserve html attributes?

Hi,


I am trying to create a html file from the rich text editor. Though the creation/conversion is successful, the html attributes of the html elements(eg paragraph tag) are lost during the creation process.

For example I need to maintain the original id for all the paragraph’s during the process.

Please help me ASAP.

Regards
Ragu

Hi

Thanks for your request. There is no way to preserve HTML attributes after loading HTML document into Document object. Aspose.Words was designed to work with MS Word documents. Since in MS Word formats elements do not have any ids, there is no such field in the model.

Best regards,

Hi,


Thanks for your prompt reply. Is there any work around for this? like saving the format as plain text or something like that?

Regards
Ragu

Hi Ragu,

Thanks for your request. Unfortunately, it is difficult to suggest you any workaround for this issue. The only possible way is parse your HTML in order to get id and index of each paragraph and then guess that indexes of paragraphs in the original HTML and in the output documents are the same. But I cannot guaranty such approach will work in 100% of cases.

Best regards,