Forum Discussion

ebodien's avatar
ebodien
Contributor
13 years ago

Qt html parser

Is there a built in way to process html text returned from a Qt applicaiton?  The .QtText and .text properties of a field return the full html code for the text.  I am only interested in what the user sees.



eg. the .text property is: <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style="font-family:'MaxDemiSerifTF-Regular'; font-size:14pt; font-weight:400; font-style:normal;"><ol style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 20px; -qt-list-indent:1;"><p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;"><tr/></p><li style="" style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the first string in the numbered list.</li><p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;"><tr/></p><li style="" style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the second string in the numbered list.</li><p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;"><tr/></p><li style="" style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the first string in the numbered list.</li><p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:1; text-indent:0px;"><tr/></p><li style="" style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This is the fourth string in the numbered list.</li>   



and all I want from this is: This is the first string in the numbered list.



Is there a built in way to do this or do I need to create my own routine to extract what I need from the html data?

1 Reply

  • A solution has been found.  The dev team has changed the QT method/module and I now have .wText and .plainText properties to work with.