Extra line break is inserted in output document using Java

Hi,

I use Aspose.Words for Java, when I outputed string to MS Word, I found extra CR introduced between lines. You can check the difference between MS Word and Java Console.

“\r\n” and ‘\n’ should have some behavior in Java, you also can check below testing Java String tmp and tmp1, in Java Console, they are the same output, but in Aspose, they are not.

So I think it’s a defect of Aspose, please advise.

My testing codes:

import java.awt.Color;

import com.aspose.words.DocumentBuilder;
import com.aspose.words.LineStyle;
import com.aspose.words.Table;

public class TestCRIssue {

    public static void main( String []argv ) throws Exception{
        DocumentBuilder docBuilder = new DocumentBuilder();

        docBuilder.clearRunAttrs();

        String tmp = "line 1\r\nline 2 after one CR\r\n\r\nline 3 after two CRs\r\n\r\n\r\nline 4 after three CRs";
        String tmp1 = "line 1\nline 2 after one CR\n\nline 3 after two CRs\n\n\nline 4 after three CRs";
        docBuilder.writeln( tmp );
        docBuilder.writeln( tmp1 );

        System.out.println( tmp );
        System.out.println( tmp1 );

        docBuilder.getDocument().save( "C:\testCellSpacing.doc" );

        // docBuilder.getDocument().updateTableLayout();
        docBuilder.getDocument().save( "C:\testCellSpacing.pdf" );
    }
}

Thanks,
Feng

Hi XianFeng,

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 apologies for your inconvenience.

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


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