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

Free Support Forum - aspose.com

How to clear the HighlightColor

I have a MS word document with some parts highlighted. I want to remove all highlighting and generate an HTML page from the document.

To do this I created a Visitor with the following overide:

public override VisitorAction VisitRun(Run run)
{
run.Font.HighlightColor = Color.Empty;
return base.VisitRun(run);
}

When generating a .Doc file this seems to work, but when I generate an HTML file I get a black background because the following style is generated:

background-color: #000000;

The alpha channel seems to be missing and I would have expected no background style to have been included.

Is there some other way to disable the highlight color?


Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for reporting this problem to us. I managed to reproduce it on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

As a temporary solution, you can try setting white highlight color as shown below:

public override VisitorAction VisitRun(Run run)

{

run.Font.HighlightColor = Color.White;

return VisitorAction.Continue;

}

But this solution will only work if text is on white background.

Another temporary workaround, I can suggest, is parsing your final HTML. You can find background-color: #000000; and replace this text with background-color: #00000000; with Alfa component.

Best regards.

In addition:

When I want to check if a run has a HighlightColor I would expect the following code to work:

if (run.Font.HighlightColor.IsEmpty) ...

But that does not work. I needed to write:

if (theHighlightColor.R == 0 && theHighlightColor.G == 0 && theHighlightColor.B == 0 && theHighlightColor.A == 0) ...

Maybe this is causing the problem. And it would be great if you can fix this as well, because I think the first line of code should work.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your remark. I think it more than reasonable. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.

Best regards.

The issues you have found earlier (filed as 15765;15806) have been fixed in this update.


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