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

Free Support Forum - aspose.com

Gray or arbitrary RGB Text Colors

Java 19.3

When I set font.setColor to Color.LIGHT_GRAY, Color.GRAY, or COLOR.DARK_GRAY I am not getting three distinct shades of gray. When I use an arbitrary RGB color (new Color (50, 50, 50)) I am also not getting a distinct color. does font.setColor work with LIGHT_GRAY, DARK_GRAY or colors with arbitrary RGB values?

@neallester,

After an initial test with the licensed latest version of Aspose.Words for Java i.e. 19.4, we were unable to reproduce this issue on our end. We would suggest you please upgrade to the latest version of Aspose.Words for Java. Hope, this helps.

Please see output document (awjava-19.4.zip (5.0 KB)) that we produced on our end by using the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.getFont().setColor(Color.gray);
builder.writeln("first");

builder.getFont().setColor(Color.darkGray);
builder.writeln("second");

builder.getFont().setColor(Color.lightGray);
builder.writeln("third");

builder.getFont().setColor(new Color (255, 0, 0));
builder.writeln("fourth");

doc.save("E:\\Temp\\awjava-19.4.docx");