Font.getBorder() and Font.getShading() creating rPr Nodes in pPr node

Hi there,
When we try to traverse the styles present in the document and try to get the border or shading information out of the fonts, this is creating empty run property nodes (rPr) in the styles.xml. Attaching two documents -

  1. WithoutEmpty_rPr.docx
  2. WithoutEmpty_rPr_StyleTraversed.docx

Please use document 1, i.e; ‘WithoutEmpty_rPr.docx’, as a input document. Try the traversal code as following:

StyleCollection sampleStyles = doc.getStyles();

for (int i = 0; i < sampleStyles.getCount(); i++)
{
    Style sampleStyle = sampleStyles.get(i);
    try
    {
        Font sampleStyleFont = sampleStyle.getFont();
        if (sampleStyleFont != null)
        {
            // sampleStyleFont.getBorder();
            sampleStyleFont.getShading();
        }
    }
    catch (Exception e)
    {
        throw new RuntimeException(e);
    }
}

After running the above code, if we save the document to file system and unzip the styles.xml and try to compare it to input document’s styles.xml, we see the output as here.

At line number 834, 846, you would see the insertion of extra node, essentially the empty run property node, which is optimized by MS word.

Ideally accessors should not modify the document state but here we are seeing the violation. Please have a look into this. Thanks.

Hi Praneeth,

Thanks for your inquiry. I tested the scenario and have managed to reproduce the same problem on my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10827. We will further look into the details of this problem and keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-10827) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan