Aspose.Drawing use with Aspose.Words

Hi,
I am currently migrating away from System.Drawing.Common as my application needs to run on Linux and I am having a bit of an issue.
I use both Aspose.Words and Aspose.Drawing and I am trying to set the font color of a paragraph using the Aspose.Drawing Color (simple example)

var document = new Document(path);
var documentBuilder = new DocumentBuilder(document);
documentBuilder.Font.Color = ***Aspose.Drawing.Color.Red***;
documentBuilder.Write("Text");
document.Save(path);

Problem is, I can’t set the color to an Aspose.Drawing Color because Aspose.Words uses System.Drawing Color type for the font color

  • Cannot convert source type ‘Aspose.Drawing.Color’ to target type ‘System.Drawing Color’
    So I was wondering, is using System.Drawing in certains cases like this an issue? Should I be able to completely get rid of System.Drawing imports and replace it with only Aspose.Drawing?

Thanks.

@anwardrevon,

I am moving your thread to relevant forum where one of the colleagues from Aspose.Words team will assist you soon.

1 Like

Any update on this?
Thanks.

@anwardrevon System.Drawing.Color is System.Drawing primitive, the same as Rectangle, RectangleF, Point and PointF and is not a part of System.Drawing.Common. You can safely use these primitives in your .NEt Standard or .NET Core projects under Linux. .NET Standard and .NET6 version of Aspose.Words does not use System.Drawing to deal with graphics, these versions uses SkiaSharp, so System.Drawing.Common is not required by Aspose.Words.

1 Like

Hello.
I have the same problem with the DocumentBuilder.Font.Color using Aspose Words 24.5.0
It seems to only accept a type of System.Drawing.Color and does not take Aspose.Drawing.Color

Is there any solution for this?

@gwert Why do not you use System.Drawing.Color? As it is mentioned above System.Drawing.Color is System.Drawing primitive, the same as Rectangle , RectangleF , Point and PointF and is not a part of System.Drawing.Common .

1 Like

Oh. I missed that.
I managed to replace almost everything replacing System.Drawing with Aspose.Drawing.

Update: It does work!

Thank you for such a fast reply @alexey.noskov

1 Like