TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nanji Mange
NA
37
5.1k
How to convert text(with html tag) to XML -WordprocessingML?
Aug 31 2016 5:06 AM
I have a string variable. I want to convert it in WordprocessingML(kind of XML). I can convert if I have only string variable(static string) but everytime value of string variable is different. I have tried by didn't get any logical idea.
Example:
Dim
strData
As
String
strData =
"This is <b>Bold</b> Text. This is <i>Italic</i> Text"
WordprocessingML (kind of XML) conversation:
<?xml version=
"1.0"
?>
<?mso-application progid=
"Word.Document"
?>
<w:wordDocument
xmlns:w=
"http://schemas.microsoft.com/office/word/2003/wordml"
xml:space=
"preserve"
>
<w:body>
<w:p>
<w:r>
<w:t>This is </w:t>
</w:r>
<w:r>
<w:rPr>
<w:b/>
</w:rPr>
<w:t>Bold</w:t>
</w:r>
<w:r>
<w:t>Text. This is </w:t>
</w:r>
<w:r>
<w:rPr>
<w:i w:val=
"on"
/>
</w:rPr>
<w:t>Italic</w:t>
</w:r>
<w:r>
<w:t>Text</w:t>
</w:r>
</w:p>
</w:body>
</w:wordDocument>
In my case, `strData` can be any string which can have HTML tags for formatting.
Ex:
strData =
"This <b>is Bold</b> Text. This is <i>Italic</i> Text"
strData =
"<b><i>This is Bold Text. This is Italic</b></i> Text"
strData =
"<b>This is Bold</b> Text."
strData =
"<b>This is Bold.</b>"
I have tried to use Replace function but it doesn't work in all cases.
Can anybody suggest me how to convert any string in this kind of format?
Reply
Answers (
1
)
Star Pattren on Name
how to call the div class name in asp.net using C#