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

Free Support Forum - aspose.com

I want to know if Aspose.Words supports unity web-side modification and saving of .docx Thanks!

IEnumerator WriteToBookmark(string fileName)
{
    System.Uri uri = new System.Uri(Path.Combine(Application.streamingAssetsPath, fileName));
    UnityWebRequest request = UnityWebRequest.Get(uri);
    yield return request.SendWebRequest();

    if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError)
    {
        Debug.Log(request.error);
    }
    else
    {
        Stream stream = new MemoryStream(request.downloadHandler.data);

        Document doc = new Document(stream);
        DocumentBuilder builder = new DocumentBuilder(doc);

        if (builder.MoveToBookmark("className"))
        {
            builder.Write("11111");
        }


        //MemoryStream outStream = new MemoryStream();
        //doc.Save(outStream, SaveFormat.Docx);
        //WebGLDownloadHelper.DownloadDocx(outStream.ToArray(), "NewOne.docx");
    }
}

This is my test code,at Document doc = new Document(stream) is error(I’m sure,stream is right!)
image.png (4.5 KB)

@zyq1111 The problem might be with document itself. Could you please attach the document that causes the problem? Simply save data from the stream you pass to Aspose.Words.Document constructor into a file and attach it here. We will investigate the issue and provide you more information.
Or you can create a simple application that will help us to reproduce the problem.

Test1.docx (10.8 KB)
This is the file I used,The web side I posted could not be uploaded due to size limitation,I can send it to you via email

@zyq1111 The attached document can be processed by Aspose.Words without any issues on my side. Could you please share your test project via dropbox or google drive? We will check the issue and provide you more information.


This is my Unity Test Project,Its only Assets ,you need Build webGL to test! thanks!

@zyq1111 I inspected the provided data and see that old version 18.7.0 of Aspose.Words is used. Could you please try using the latest 21.12 version of Aspose.Words and let me know if the problem still persists on your side.
I am not familiar with Unity development, could you please point me at the guide how to run your code on my side? Then I will check and provide you more information.

I have tested version 21.12, but the problem still exists。https://github.com/dlkj01/WebGLTest It’s a Html,You need to deployment tomcat running and click Download

The main code is the 1st floor

@zyq1111 Thank you for additional information. I have created a task WORDSNET-23271. I will configure the required environment to test Aspose.Words in WebGL and let you know my results.

I would like to know if there is any progress on this issue, thanks!

@zyq1111 I have configured the environment and managed to reproduce the problem you mentioned. We will further investigate the issue and provide you more information.

I am very much looking forward to solving this problem, thank you very much

@zyq1111 The issue is currently in the queue for analysis. We will let you know once there are some news.

@zyq1111 We have completed analyzing the issue and regret to share that currently you cannot use Aspose.Words in Unity WebGL projects. Unity, while building to WebGL platform, translates .Net IL-code to Wasm binary format (some bytecode for a low-level WebAssembly virtual machine).
Seems some .Net Framework features cannot be ported correctly.

Thanks a lot for being able to give me a detailed answer, thanks again!