We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Parsing bold style text into a doc file

Hello,


Please, could you say me if there are any examples, which explain how to finding text with style Bold into a .doc file ?

Thanks for your help !

Hi,


Thanks for your inquiry. Please try using the following code:
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = <span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>new <span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document(<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>“D:<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>temp<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>in.doc”<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>);
<pre style=“font-family: “Courier New”; font-size: 9pt;”>
for(Run run : (Iterable) doc.getChildNodes(NodeType.RUN, true)) {
if (run.getFont().getBold()) {
System.out.println(run.getText());

}
}

Hope, this helps.

Best regards,

That is working, many thanks ! :slight_smile: