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

Free Support Forum - aspose.com

Font color question

Hi, I have a question about automatic font color handling. When reading font color from run, and that font color has automatic color aspose returns to me black color. And if I write that text with black highlight it can not be seen. Take a look at my code snippet:
Document document = new Document(inputStream);

List runs = getRuns(document);

Run run = runs.get(0);

Font font = run.getFont();

Color color = font.getColor(); // returns white

run = runs.get(1);

font = run.getFont();

color = font.getColor(); // returns white

DocumentBuilder builder = new DocumentBuilder(document);

builder.moveToDocumentEnd();

builder.getFont().setHighlightColor(Color.BLACK);

builder.getFont().setColor(color);

builder.write(“new text”);

document.save(outputFile); // new text cannot be seen

Can you please tell me how can I handle automatic color?

I am using aspose for java. There is simple file in attachment.

Thanks, Ivica.

Hi

Thanks for your inquiry. Automatic color does not work with highlighting. If you write text and set black highlighting you will not see the text.

Automatic color is Color(0, 0, 0, 0). You can test this using the following code:

Document document = new Document();

DocumentBuilder builder = new DocumentBuilder(document);

builder.getCellFormat().getShading().setBackgroundPatternColor(Color.BLACK);

builder.getFont().setColor(new Color(0, 0, 0, 0));

builder.insertCell();

builder.write("new text");

builder.endRow();

builder.endTable();

document.save("out.doc");

Best regards.