Gradient fill color appears colored homogenous

Hi Team,
we are facing an issue where a templated word document appears to have homogenous colored objects from a gradient fill HTML content. I attached a simple console application to reproduce the issue. It looks like gradient fill is ineffective and word only takes one color. Can you advise on this?
Thank you very
GradientFillPPTHtmlContent.zip (508.3 KB)

much for your help

@ottap

It seems you are experiencing an issue with gradient fill colors in a templated Word document, where the gradient appears as a homogenous color instead of displaying the intended gradient effect. This can happen due to various reasons, including the way the gradient is defined or how the document is being processed.

To address this issue, you can try the following steps:

  1. Check Gradient Definition: Ensure that the gradient fill is defined correctly in your code. For example, if you are using a two-color gradient, make sure both colors are specified properly. Here’s a sample code snippet for applying a two-color gradient fill:

    Shape shape = builder.InsertShape(ShapeType.Rectangle, 100, 100);
    shape.Fill.TwoColorGradient(Color.Red, Color.Blue, GradientStyle.Horizontal, GradientVariant.Variant1);
    
  2. Use the Correct Save Options: When saving the document, ensure that you are using the appropriate save options that support gradient fills. For instance, using OoxmlSaveOptions with the correct compliance level can help retain the gradient effects:

    OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.Docx)
    {
        Compliance = OoxmlCompliance.Iso29500_2008_Transitional
    };
    doc.Save("output.docx", saveOptions);
    
  3. Test with Different Document Formats: Sometimes, the issue may arise from the specific format of the document. Try saving the document in different formats (like PDF or HTML) to see if the gradient appears correctly in those formats.

  4. Update Aspose.Words Library: Ensure that you are using the latest version of the Aspose.Words library, as updates often include bug fixes and improvements related to rendering and formatting.

If the problem persists after trying these steps, consider sharing a minimal reproducible example or the specific code you are using to apply the gradient fill. This will help in diagnosing the issue more effectively.

Feel free to reach out if you need further assistance!

@ottap
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-28111

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.