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

Free Support Forum - aspose.com

Spaces in a text file a truncated

Hello. I’m using Aspose.Words for .NET version 15.3.0

The following code truncated leading and trailing spaces from the source string:

const string inputData = " Spaces ";
var encoding = Encoding.UTF8;
using (
MemoryStream inputStream = new MemoryStream(encoding.GetBytes(inputData)),
outputStream = new MemoryStream())
{
var document = new Document(inputStream, new Aspose.Words.LoadOptions { Encoding = encoding, LoadFormat = Aspose.Words.LoadFormat.Text, AllowTrailingWhitespaceForListItems = false });
document.Save(outputStream, new Aspose.Words.Saving.TxtSaveOptions { Encoding = encoding, });

var outputData = encoding.GetString(outputStream.GetBuffer());
}

I have not found any property in LoadOptions or SaveOptions that allows to control such behavior. Is this a bug?

Hi Artem,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14858. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-14858) have been fixed in this Aspose.Words for .NET 18.7 update and this Aspose.Words for Java 18.7 update.