We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Missing white spaces after upgrade to Aspose.words 15

Dear Team,

I’m creating png documents based on docx templates. After update from 13.3.0 to aspose.words 15.8.0 (current stable version) we are not able anymore to convert more than 1 sequence of white spaces.

i.e: begin white 3 spaces and 8 spaces after it.
will print: begin 3 spaces and 8 spaces after it.
You can observe on attached pngs the price descriptions and burritos/sandwiches. It has white spaces before begin the “real” words char sequence.

This new version contain some feature to “fix” white spaces sequences?
if yes I’ll need a way to disable it.

Let me know if you guys need more info or some examples.

I’ve executed a simple code to reproduce it. You can see it bellow:

License license = new License();
license.setLicense( "Aspose.Words.lic" );
Document doc = new Document("template.docx");
ImageSaveOptions options = new ImageSaveOptions(SaveFormat.PNG);
options.setResolution(138);
doc.save("result.jpg", options);

Results will be different between aspose versions 15 and 13. Follow the result.jpg images attached with his respective version file description.
Interesting point:
During convert process (old version 13) Fonts didn’t work as expected (you can see on attached file) when we migrate from windows to linux env. This was the main motivationto buy a new key and start to use the current version 15 who offers support for Unix based SO fonts and worked as expected although another important feature, write white spaces, stopped to work since then.

  • Additional info.
    Env description:
    Ubuntu 14.04.3 LTS (GNU/Linux 3.13.0-62-generic x86_64)
    java version “1.8.0_51”
    Java™ SE Runtime Environment (build 1.8.0_51-b16)
    Java HotSpot™ 64-Bit Server VM (build 25.51-b03, mixed mode)

Let me know if you guys need any extra information.

Thanks,
Mauricio Carvalho

Hi Mauricio,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please

create a simple Java application that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. I will
    investigate as to how you are expecting your final document be generated
    like.

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

tahir.manzoor I’ve updated this thread to offer the requested files. Let me know if you need any extra info.

Regards,
Mauricio Carvalho

Hi Mauricio,

Thanks for sharing the detail.

*maurcarvalho:

we are not able anymore to convert more than 1 sequence of white spaces.

i.e: begin white 3 spaces and 8 spaces after it.
will print: begin 3 spaces and 8 spaces after it.
You can observe on attached pngs the price descriptions and burritos/sandwiches. It has white spaces before begin the “real” words char sequence.*

Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to fixed file format e.g Pdf, Xps, you will get the same output.

The output of latest version of Aspose.Words v15.8.0 is correct. I have not found any spaces before text “burritos” and “sandwiches”. Please check the attached screenshot of input Word document.

Hope this answers your query. Please let us know if you have any more queries.

Actually the spaces before text “burritos” and “sandwiches” is the expected one like it’s what is causing problems for us. Look at the first attached image, the only problem there is the messy up of fonts, that’s why we updated aspose lib version. Is possible to disable this fixed file convert and work as before?
I want to handle it as we did with the version 13 of aspose lib. Is that possible?

Hi Mauricio,

Thanks for your inquiry. Please note that there are no spaces before the text “burritos” and “sandwiches”. The output generated by latest version of Aspose.Words is correct. The spaces before text “burritos” and “sandwiches” in output generated by older version is seemed to be a bug and fixed in latest versions of Aspose.Words. However, if you want to add spaces before specific text, you can use Range.Replace method to achieve your requirements.

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "template.docx");
doc.getRange().replace("burritos"," burritos", false, false);