web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Problem with compressed attached files in FORM DocuView

(0) ShareShare
ReportReport
Posted on by 4,075

I am trying to find a way to show attached documents in the DocuView form, but the problem is that the documents are saved in blob storage as compressed files. (This has been done because most of the documents the customer has are XML files, and since they can be compressed quite a lot, it seemed like a good idea to save on storage space.)
So when they are showed on the form they look like this.

pastedimage1597834029422v2.png

So I need to find a way to uncompress the data before its shown in the form.

I have been looking into the code that is run when a record with an attached document is shown in the form, but I have only so far been able to find this.

In this method, DocumentManagement.getDisplayUrl it seems that the URL of the blob storage file is found.
This method is being called from DocumentViewer.createDocument, where the document information is then saved in viewerDocument’s(Class DocumentViewerDocument) parm methods.

And then the saved url is used in the DocuViewerContainer control on the Form DocuView.

So my problem now is I do not know how to change what is shown in that Control?
Do I need to receive the file from the URL, uncompress is and save it again as a temp file in the blob storage, and pass the new URL to the control? And then remove the file when the control is done using it? (Witch seems like a bad solution, since it would take extra time, and there is a chance that the temp file well not be deleted and left behind.)
Or is it somehow possible to change the content of the file before its shown in the control on the form?

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,069 Super User 2025 Season 2 on at

    Hi Rudi,

    I don't have a direct answer for you. There is an example in the standard application. This is in the Data Management import projects. When you import a package, it will be uploaded and extracted where the individual files will be used to import. Probably, you can learn from how this is developed by Microsoft.

  • Rudi Hansen Profile Picture
    4,075 on at

    Hi Andre.

    How does this have anything to do with the DocuViewerContainer control?

    Its possible that there is some file handling in this that might be a little similar to the DocValue file handling code, but its not the file handling that is my problem, its the showing of the file in the DocuViewerContainer that I am having problems with.

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    The control displays whatever you uploaded. If you upload normal xml file (without doing compression )and try to see it in control , does it show properly ? If yes , then unfortunately you have to do what you have described in the last paragraph of your question

  • nunomaia Profile Picture
    25 Moderator on at

    What you are trying to achieve is not straightforward.

    Attachment preview is not rendered in DocuViewerContainer but rather in Office Online Server. This service don’t decompresses files for creating the preview. If your files are compressed and saved with XML extension, it will render incorrectly because assumes that your ZIP file is a text file.

    You can create your rendering service of those compressed files and overwrite the rendering URL.

  • Rudi Hansen Profile Picture
    4,075 on at

    Hi Nuno.

    Ok this sounds interesting, where do you see that its using Office Online Server to render the preview?

    And do you have any idea where in the code I might add my own rendering?

  • nunomaia Profile Picture
    25 Moderator on at

    in DocumentViewer class in createDocument method, the rendering URL will be obtained.

    If you open the rendering URL directly in a browser ( don’t forget the matching security token ) you can see the preview result  

    If is a document type support by Office, preview will rendered using office. Documentation about that docs.microsoft.com/.../configure-document-management

    If a type is supported by the browser it will render directly in browser without conversion, only extract data from blob storage and display directly in browser.

    You could create your own a preview engine.  

    The main decision for rendering. WOPI = Microsoft Online Server API or native. 

    1565.Capture.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans