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

Free Support Forum - aspose.com

Avoid File Corrupted Exception upon Loading a RTF Document with *\datastore | C# .NET

UneditableChunk_MakeItWork.7z (9.3 KB)

Hi Team,

The actual error i am getting is below stack trace

Aspose.Words.FileCorruptedException: The document appears to be corrupted and cannot be loaded. —> System.ArgumentOutOfRangeException: Non-negative number required. Parameter name: count

And things to observe that removing a portaion of data Chunk [Remove from " {*\datastore " till end ] from the file attached “UneditableChunk_MakeItWork.txt” and upload in Aspose.word online portal documents viewd successfully but with keeping same data portion in other doucments it works without issue then why only some documents is having issue ?

There are other documents for which Aspose gives error and attached is one of them.

Please let us know if the reason or if you need any other information from me.

Thanks,
Ajay

@ajimpact,

For the sake of any correction in Aspose.Words API, we have logged this problem in our issue tracking system with ID WORDSNET-22374. We will further look into the details of this problem and will keep you updated on the status of linked issue. We apologize for any inconvenience.

Did Team got the root cause of issue. Please let us know asap.
can you give an update on WORDSNET-22374 ?

At present we are using a licensed Version of Aspose.Word For .NET library Version 17.12.0.0

Thanks

@ajimpact,

The archive you shared contains a TXT file, at the beginning of which the following text is indicated:

{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}  {\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}
...

So, it looks like to be an RTF document. When MS Word 2019 tries to open this RTF document, it reports several errors and cannot display the document text: (see WORDSNET-22374 Analysis 1.png (16.4 KB)). Aspose.Words can currently not import this RTF document either. We think that we can add resilience in code to be able to load this file with Aspose.Words. We will inform you via this forum thread as soon as this issue will get resolved in future.

Below information will be useful to you -

We tried with two different version of Aspose.Word DLL and found that with Aspose version 21, if we remove entire “*\datastore” portion till end, the errored documents appears successfully whereas with Aspose verion 17 , if we remove “*\datastore” portion till end the errored documents does not appears.
Yes, it’s RTF document and we tried above with visual studio with Aspose verion 17 and 21 and both version have diffrent behaviour.

Please let us know asap the reason of issue and fix as well.

Thanks.

@ajimpact,

Thanks for the additional information. We have good news for you i.e. WORDSNET-22374 has now been resolved. The fix of this issue will be included in the next 21.7 version of Aspose.Words. We will inform you via this forum thread as soon as the next version containing the fix of this issue will be released at the start of next month.

Thank you for the Quick Update.

We can definitely consume Aspose 21.7 version in the major release of our product can you please direct me to the 21.7 release notes.

In the interim, is there any workaround solution that you can suggest us for the consumption of Aspose version “17.12.0.0”. and make it work.

Here is the sample code snippet which we are using to create the document based on the attached RTF file

string rtf = System.IO.File.ReadAllText(@"C:\test_Data\UneditableChunk_MakeItWork.txt"); // physical path location of the attached file 

MemoryStream stream = new MemoryStream();
StreamWriter writer = new StreamWriter(stream);
writer.Write(rtf);
writer.Flush();
stream.Position = 0;
Aspose.Words.Document doc =  new Aspose.Words.Document(stream);// This line throws error at present

@ajimpact,

We will also publish release notes of 21.7 version at the start of next month in the following section of documentation:

Secondly, I am afraid, there isn’t any workaround available and you will have to wait for the fix of WORDSNET-22374 to come out.

Thank you for the quick response.

Could you please confirm the below details as well -

  1. Release date of 21.7 Aspose.Word ?
  2. As there is still a time for release 21.7. so meanwhile can we get any prerelease draft of 21.7 Aspose.Word DLL, which we can use for our DEV testing ?

Thanks

@ajimpact,

Next 21.7 version of Aspose.Words for .NET API will be published within the first two weeks of July 2021. You will be notified here as soon as the next 21.7 version will be released.

Secondly, I am afraid, only Enterprise Support customers are eligible for a ‘hotfix’ (interim) build. So, if this issue is extremely urgent, and you have Enterprise Support account, then you can request a hotfix by using the Paid Support helpdesk.

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