Field Code Font Borders Missing When Converting DOCX to PNG

I’m experiencing a rendering issue where Field Code content with font borders does not display correctly. While font borders render properly in normal text content, they are missing when applied to field codes.

To help reproduce the problem, I have prepared the following:

Sample Code:

using Aspose.Words;
using Aspose.Words.Saving;
using Aspose.Words.Shaping.HarfBuzz;

var license = new License();
license.SetLicense(@"licensePath");

var document = new Document(@"inputDocxPath");
// document.UpdateFields();

var pngSaveOptions = new ImageSaveOptions(SaveFormat.Png)
{
    // MetafileRenderingOptions =
    // {
    // RenderingMode = MetafileRenderingMode.VectorWithFallback,
    // EmulateRasterOperations = false
    // }
};
document.Save(@"outputPngPath", pngSaveOptions);

Sample Docx:
fieldCode_border.docx (14.3 KB)

Aspose Result:

Expeceted Result:

Environment:

  • .NET Framework 4.8
  • Aspose.Words 25.9.0

Could you please confirm whether font borders on field codes are supported in this scenario? If this is a known limitation, are there any recommended workarounds to achieve the expected rendering behavior?

@SzuChiChen

The issue you’re experiencing with font borders on field codes not rendering correctly when converting DOCX to PNG may be related to font availability or rendering settings. Here are some steps you can take to address this:

  1. Ensure Font Availability: Verify that the required TrueType fonts are installed on your system. Aspose.Words needs access to the correct fonts for accurate rendering. If a specific font is not available, it may be substituted with a similar font, which might not render as expected.

  2. Review Document Formatting: Check the formatting of the field codes in your DOCX file. The way field codes are formatted can significantly affect rendering.

  3. Use the Latest Version: Ensure you are using the latest version of Aspose.Words for .NET, as updates may include bug fixes and improvements related to rendering.

  4. Testing Different Output Formats: If the issue persists, try converting the document to other formats (like PDF) to determine if the rendering issue is specific to PNG output.

  5. Implement a Warning Callback: Use the IWarningCallback interface to capture any warnings during the conversion process. This can help identify if any fonts are being replaced and why.

If you continue to experience issues, please provide more details about the specific field codes and the fonts involved for further assistance.

  1. Font Availability Confirmed: I have already verified that the required fonts are properly installed and available on the system.

  2. Version Updated: I am using the latest version of Aspose.Words (confirmed up-to-date).

  3. Cross-Format Testing: I have tested the rendering across multiple output formats, and the font border issue persists consistently:

Aspose output (PDF):
fieldCode_border.pdf (34.3 KB)

Aspose output (jpeg):
fieldCode_border.jpeg (7.2 KB)

@SzuChiChen
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-28679

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.