Getting Paragraph text as HTML content

HI,
I am inserting a paragraph into document. Paragraph text contains HTML content, like

Click here to go

Now programatically i am fetching the paragraph text as a string, like

string strPara=para.ToTxt().ToString();

But, para text is having only ‘Click here to go’, i need entire HTML content for further use. Same prob is happening for images also, if para having image, it is also not comming…

Is there any method is there to get the Paragraph text as a HTML for hyperlink type of text and how should i fetch images if para having images…

Regards,
Srinivas

Hi Srinivas,

Thanks for your inquiry. Unfortunately, there is no way to get Paragraph text as a HTML string.
When you insert HTML with hyperlink into the word document, it is represented as a MS Word field. Each field in MS Word consists of FieldStart node, field code, FieldSeparator node, field value (displayed text) and FieldEnd node. When you get text from a paragraph field codes are ignored so you see only “Click here to go” text.
If you need to get text including field codes, you should use Node.GetText method.
https://docs.aspose.com/words/net/how-to-extract-selected-content-between-nodes-in-a-document/
Regarding images, how do you think images should be represented in text? If you would like to work with MS Word document content, you should do that using DOM:
https://docs.aspose.com/words/net/aspose-words-document-object-model/
Could you please explain your goal? And I will try to help you.
Best regards.

Hi Alexy,
Thanks for your quick response…
Please find the attached the test documnet… It contains only 3 paragraphs like
one is normal line and second one is hyperlink and 3rd one is an Image…
Now i need to fetch individual lines… and placing on my webpage.
with first line there is no problem, but how should i fetch the 2nd line and 3rd line…
with 2nd line i am getting only text like ‘Click here to go’ for hyperlink field…
and how should i fetch the image to place on my webpage…
please help me out…
Regards,
Srinu Dhulipalla

Hi

Thank you for additional information. The only way to do what you need is converting whole document to HTML. Then you can parse output HTML and get necessary content.
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.
(2)