We use Aspose Words for Java to convert .DOCX to .HTML. Since the beginning of February 2025, we have seen a significant increase in “FileCorruptedException”. Previously we encountered this 1-2 times a year. In the last 2 months, we have had 200 instances of this conversion error.
The documents generating this exception do not have any obvious issues. They are editable in Word and do not contain any of the known problems, like watermarks, cropped images, or embedded code. Once a file is “corrupted”, it cannot be fixed by any editing method we have tried. Even removing all content from the document and replacing with simple text does not result in a successful conversion. The only solution we have found is to recreate the file by copy/pasting the content into a new blank document.
Our setup:
Aspose Words for Java version #15.12.0
Word versions range from 2412-2502
It seems you are encountering a significant increase in FileCorruptedException when converting DOCX files to HTML using Aspose.Words for Java. This issue has become more frequent, and the documents in question do not appear to have any obvious problems, as they are editable in Microsoft Word.
Here are some steps you can take to troubleshoot and potentially resolve this issue:
Update Aspose.Words: You are currently using version 15.12.0, which is quite outdated. Consider upgrading to the latest version of Aspose.Words for Java. Newer versions often include bug fixes and improvements that may resolve issues like the one you are experiencing.
Catch the Exception: You can implement exception handling in your code to catch FileCorruptedException. This will allow you to log the error message and possibly identify patterns in the documents that cause the issue. Here’s a sample code snippet to demonstrate this:
import com.aspose.words.*;
public class DocumentConverter {
public static void main(String[] args) {
try {
Document doc = new Document("path/to/your/document.docx");
doc.save("path/to/output/document.html", SaveFormat.HTML);
} catch (FileCorruptedException e) {
System.out.println("File is corrupted: " + e.getMessage());
} catch (Exception e) {
System.out.println("An error occurred: " + e.getMessage());
}
}
}
Document Analysis: Since you mentioned that the documents do not contain known issues (like watermarks or embedded code), consider analyzing the structure of the DOCX files that cause the exception. You might want to check for any unusual formatting or unsupported features that could lead to corruption during conversion.
Recreate the Document: As you noted, recreating the document by copying and pasting the content into a new blank document has worked for you. This suggests that there may be hidden corruption in the original file. If possible, try to identify what specific content or formatting leads to the corruption.
Contact Support: If the problem persists after trying the above steps, consider reaching out to Aspose support with specific details about the documents that cause the issue. Providing sample documents can help the support team diagnose the problem more effectively.
By following these steps, you should be able to mitigate the frequency of FileCorruptedException and improve the reliability of your document conversion process. If you have any further questions or need additional assistance, feel free to ask!
@cw7345 The problem is not reproducible on our side using the latest 25.3 version of Aspose.Words. Please try using the latest version and let us know if the problem still persists on your side.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.