Faced a bug while reading Bold text

Hi,

I am creating a word document, which has a section with Bold text.

When i parse the same word file, the paragraph.Font.Bold property returns false. I think it is a bug.

Iam using Aspose.Words 3.7.0.0

regards

Vivek Bahl

Please attach the code snippets illustrating the problem.

Best regards,

Please find the document attached with this reply.

I can see that paragraph format for "Resource Requirement" and "Associated Standard" is not bold, while this strings appear as bold in MS Word. The point is that bold formatting as well as many other formatting settings can be applied on different levels in MS Word. In this case the run's font is bold while paragraph font is not. You can check it if you save the document in WordML format. The bold (w:b) tag for this text strins is applied on run level (rPr) rather than paragarph level (pPr).

Best regards,

Hi,

Thanks for early reply, could u please suggest a way, some sample code to acheive the result as is desired over here.

regrads
Vivek bahl

Please provide a more detailed description of your task. From your post it is not entirely clear what you are trying to achieve.

Best regards,

Hi,

I am creating a word document, (using aspose) with certain paragraph's text formatted as bold. The Text inBold signifies a Heading, while any para following it contains text associated with that Heading.

Now after a user review this document and adds comments to it, the document is uploaded again, and parsed again for the original content and users comments, but while this process of parsing we are not able to validate that the Heading formatted as bold is present in the document, as using Aspose we are not able to Detect the formatting.

I hope this would help you understand the scenario, and provide the required sample of code.

Regards
Vivek bahl

In your case you can use the following procedure to verify if the paragraph text is formatted as Bold:

private bool IsHeading(Paragraph para)

{

if (para.Font.Bold)

return true;

foreach (Run run in para.Runs)

{

if (!run.Font.Bold)

return false;

}

return true;

}

Best regards,

Hi Miklovan,

Thanks for your suggestion, i have succesfully implemented the functionality.

Regards

Vivek bahl

In Aspose.Words 4.0 and earlier, Paragraph.Font gets or sets font of the PARAGRAPH BREAK character only. It does not apply to the whole text in the paragraph.

It looks like this is causing confusion and I'm going to rename it to something like Paragraph.ParagraphBreakFont.

Also, if the users insist, I can add Paragraph.Font that will allow getting/setting font of the text (all runs) inside a paragraph. Getting of course will return font of the first run.