Free Support Forum - aspose.com

Missing spaces in document after resave the docx using Java

I experienced a very strange problem. When I extract the text from a docx file I noticed that all spaces are missing.


String name = “test.docx”;
Document doc = new Document(name);
System.out.println(doc.getText());

When I open it with Microsoft Word it looks fine. If I load it with Aspose and save it as a new file and then open the new file with Microsoft Word the spaces are already gone.

String name = “test.docx”;
Document doc = new Document(name);
doc.save(“new " + name);

I inspected all Run instances and none of them contains any spaces.

I extracted then the xml from the docx file and it looks that the spaces are indeed present in separate runs.

<w:r>
<w:rPr>
<w:rFonts w:ascii=“Arial” w:hAnsi=“Arial” w:cs=“Arial” w:eastAsia=“Arial” />
<w:sz w:val=“27” /><w:szCs w:val=“27” />
<w:color w:val=“2B2E71” />
<w:spacing w:val=“38” />
<w:w w:val=“86” />
<w:position w:val=”-1" />
</w:rPr>
<w:t> </w:t>
</w:r>

<w:r>
<w:rPr>
<w:rFonts w:ascii=“Arial” w:hAnsi=“Arial” w:cs=“Arial” w:eastAsia=“Arial” />
<w:sz w:val=“27” />
<w:szCs w:val=“27” />
<w:color w:val=“2B2E71” />
<w:spacing w:val=“0” />
<w:w w:val=“100” />
<w:position w:val="-1" />
</w:rPr>
<w:t>Manager</w:t>
</w:r>

I performed another test - opened the file in Microsoft Word, then saved it. The new version is good now for processing with Aspose - the spaces are there, in separate runs, which were not present before.

What might be causing this?

Hi Gozo,

Thanks for your query. I have managed to reproduce the same problem at my end. I have logged this issue in our issue tracking system and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Hello Gozo,

I have good news for you. Your problem is already resolved in the latest version of Aspose.Words 10.8.0. This version was released few days ago. You can download the latest version from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

The issues you have found earlier (filed as WORDSNET-6304) have been fixed in this .NET update and this Java update.


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