cancel
Showing results for 
Search instead for 
Did you mean: 

How to avoid preview screen for specific mime types (e.g Excel)

sejoon
Champ in-the-making
Champ in-the-making
Dear all

i'm using Alfresco 4.1.x now.

i'd like to avoid preview screen when the file is Excel(xls, xlsx).
If the doc is Excel file, and user clicks, i want download action. Not preview action.

How can i achieve this?

Regards.
Ahn
2 REPLIES 2

miguelsan
Champ in-the-making
Champ in-the-making
There isn't a regular way to do this, you need to be creative to find a way.
In order to change the default behavior that Share provides in the documentlibrary page, when a user clicks over a content item, you have two options:

1. Modify the document-details page behavior (The one that contains the document preview) Before the page loads completely, download the content if it is an excel and get back to the previous page.
2. Modify the particular component that generates the item list (documentlibrary) in the document

The first option would be more suitable, although it's not a simple hack and implies several things:
a. Create a webscript to evaluate a node's mimetype
b. Create a javascript function that will call the webscript through AJAX. If the content is an excel document the function will call the url that downloads it and then get back to the documentlibrary page. (to get the noderef you can use Alfresco.util.getQueryStringParameter("nodeRef"))
c. Include the javascript in the page document-details (using share-config dependencies or modifying the document-details page itself)

If you have the time and the courage you can try the second option. You will find this component (documentlist) in <tomcat>/webapps/share/WEB-INF/classes/alfresco/site-webscripts/org/alfresco/components/documentlibrary

niketapatel
Star Contributor
Star Contributor
Hi Sejoon, Yes You need to do customization as miguelsan mentioned.

But this is FYI.. You can also disable content preview based on mimetype. Preview action would be as it is, it only disables content preview generation!
If it satisfies your requirement then it would save your time.

http://wiki.alfresco.com/wiki/Content_Transformation_Limits#Disabling_a_transformer