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

Free Support Forum - aspose.com

Re: Run background

Hi, can you look at following code:

Document document = new Document(inputStream);

List paragraphs = getParagraphs(document);

Paragraph paragraph = paragraphs.get(1);

System.out.println(paragraph.getParagraphFormat().getShading()
.getBackgroundPatternColor().toString()); // java.awt.Color[r=0,g=0,b=0]

System.out.println(paragraph.getParagraphFormat().getShading()
.getForegroundPatternColor().toString()); // java.awt.Color[r=0,g=0,b=0]

It should return some color or I am doing something wrong?
You have example document in the attachment.

Thanks, Ivica.

Hi

Thanks for your inquiry. This is not Paragraphs background color but it is Font.Shading.BackgroundPatternColor. See the following link for more information.
https://apireference.aspose.com/words/java/com.aspose.words/shading#BackgroundPatternColor

Hope this helps.

Also here is code example:

//Open the document
Document doc = new Document("C:\\Temp\\in.doc");
//Get collection of Runs
NodeCollection runs = doc.getChildNodes(NodeType.RUN, true);
//Loop though all runs
for (int i = 0; i < runs.getCount(); i++)
{
    Run currentRun = (Run)runs.get(i);
    //Get shading color
    System.out.println(currentRun.getFont().getShading().getBackgroundPatternColor());
}

Best regards.