HTML of a single node

Hi,

Is is possible to get HTML of the content of a single node in a Word document?

Thanks,
Shay

Hi
Thanks for your inquiry. There is no direct way to achieve this. But you can import note into the empty document and then save this document in HTML format. For example see the following code:

// Open document
Document doc = new Document("in.doc");
// Create temoporary document
Document temp = new Document();
// Import first paragraph 
Node dstNode = 
temp.ImportNode(doc.FirstSection.Body.FirstParagraph, true, ImportFormatMode.KeepSourceFormatting);
// Insert note into the temporary document
temp.FirstSection.Body.AppendChild(dstNode);
// Save html to MemoryStream
MemoryStream htmlStream = new MemoryStream();
temp.Save(htmlStream, SaveFormat.Html);
// Get Html string
string htmlString = Encoding.UTF8.GetString(htmlStream.GetBuffer());

This code converts first paragraph to HTML string.
Hope this helps.
Best regards.

Is it possible to do that for a specific XMLNode inside the document?

Thanks.

Hi
Thanks for your inquiry. No, you can’t do that for XMLNode. However if you are able to isolate specific XMLNode inside separate document then you can achieve this
Best regards.

Is it possible at all to find xml nodes inside a document with your class library?

Thanks.

Hi
Thanks for your inquiry. No you can’t find xml nodes using Aspose.Words. Please see the following links to learn more about document object model.
https://docs.aspose.com/words/net/aspose-words-document-object-model/

Best regards.

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

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