Problem in custom dashlet to display ms word document

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2009 07:27 AM
Based on the Alfresco Developer guide by Mr.Jeff, I created a custom dashlet to display press releases. I stuck a couple of MS Word documents into the space but the text displayed in the press release area is:
test_doc.docx
PK � � ���!�� 腉 �� �� � [Content_Types].xml � (�� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������…
The title is indeed test_doc, but all the question marks are not part of the document.
The dashlet that is displaying the document is below, customized a little from the ebook.
test_doc.docx
PK � � ���!�� 腉 �� �� � [Content_Types].xml � (�� ��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������…
The title is indeed test_doc, but all the question marks are not part of the document.
The dashlet that is displaying the document is below, customized a little from the ebook.
<table> <#assign l_space = companyhome.childByNamePath["My Space/Test Space"]> <#list l_space.children as doc> <#if doc.isDocument> <tr> <td> <a class="title"href="/alfresco/${doc.url}">${doc.properties.title}</a> </td> </tr> <tr> <td style="padding-left:8px"> <#if (doc.content?length > 500)> <small>${doc.content[0..500]}…</small> [ 270 ] <#else> <small>${doc.content}</small> </#if> </td> </tr> <tr><td> <HR> </td></tr> </#if> </#list></table>
Labels:
- Labels:
-
Archive
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2009 05:29 AM
The content of a Word file is binary data! 
You need to convert to plain text. You can use the following:
This should also work, but i haven't tried it:
Kevin

You need to convert to plain text. You can use the following:
${cropContent(doc.properties.content, 500)}
This should also work, but i haven't tried it:
${doc.properties["cm:content"].getContentAsText(500)}
Kevin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-28-2009 07:34 AM
hi Kevin,
Excellent work…. Thanks again.
Excellent work…. Thanks again.
