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

Free Support Forum - aspose.com

Illegal characters in path exception when saving MHTML as HTML with custom ResourceLoadingAction

Hello,

Saving the attached MHTML file to HTML with Aspose.Words for .NET 21.9, using a custom ResourceLoadingAction action to skip external resources, causes a “System.ArgumentException: Illegal characters in path” exception:

public static void Convert()
{
    var loadOpts = new Aspose.Words.Loading.LoadOptions
    {
        LoadFormat = Aspose.Words.LoadFormat.Mhtml,
        ResourceLoadingCallback = new WordDocImageHandler()
    };

    var word = new Aspose.Words.Document("input.mhtml", loadOpts);
    word.Save("output.html");
}

private class WordDocImageHandler : Aspose.Words.Loading.IResourceLoadingCallback
{
    public Aspose.Words.Loading.ResourceLoadingAction ResourceLoading(Aspose.Words.Loading.ResourceLoadingArgs args)
    {
        return Aspose.Words.Loading.ResourceLoadingAction.Skip;
    }
}

input.zip (12.2 KB)

If the ResourceLoadingAction is Default, it saves correctly. But having it set to Skip causes the “Illegal characters in path” exception.

This looks like a bug because it should just be skipping the resources. Can you please advise.

Thanks

@ast3,

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

Hello,

I see the status is “WORDSNET-22750 ---- Status : Closed”. Has this issue been fixed in latest version?

Thanks

@ast3 The fix will be included into the upcoming 21.11 version of Aspose.Words, which will be released in a week or two. We will keep you informed and let you know once it is available.

The issues you have found earlier (filed as WORDSNET-22750) have been fixed in this Aspose.Words for .NET 21.11 update also available on NuGet.