Insert SVG Image in Word DOCX Document & Preserve Text Wrapping & Alignment using Java | Custom Fonts

This code inserts an SVG into a word document. The produced word document has an SVG that has its text completely misaligned. Can you have a look please. The code is:

FontSettings.getDefaultInstance().setFontsSources(new FontSourceBase[] { new SystemFontSource(), new FolderFontSource("fonts", true) });
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
String svgString = Files.readString(Paths.get("svg/input_misaligned.svg"));  
builder.insertImage(svgString.getBytes(StandardCharsets.UTF_8));
doc.save("output.docx");

It loads the fonts from the fonts subdirectory. Those are required to reproduce the issue. It also loads the SVG from the svg folder.

We are using Aspose.Words for Java 20.6.

The data is in the attached zip file.

data.zip (694.3 KB)

@bmpi,

We can also observe text misalignment when inserting SVG into Word document on our end. We have logged this problem in our issue tracking system with ID WORDSNET-21276. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier have been fixed in this Aspose.Words for .NET 20.12 update and this Aspose.Words for Java 20.12 update.