Blackberry: Office attachments can be opened from email but not from browser - blackberry

We have a Web application (ASP.NET) which displays in some page links to miscellaneous Office documents.
The links are not to web files but rather to a web page which dynamically loads the content form a network folder then sends it to the browser by appropriately setting the mime type.
Everything works fine when testing with desktop browsers (a.k.a. the browser proposes the right application to open the file and the file is successfully opened).
When testing with a Blackberry (Bold 9000) the built-in browser raises an error message stating the selected item (an Excel document) cannot be displayed.
The odd thing is Excel files attached to mail messages can be opened on the same device (via Documents To Go I think).
Anybody has an idea why the Excel attachment could be opened as email attachment but not when downloaded from web? Could this be caused by an incorrect MIME type setting?
Please note that the Blackberry testing was done only by a (remote) user as the BB used for development has an older OS (4.3) which doesn't support Office files anyway. I am not able to actually test with a 4.5+ BB.
Here's the code (excerpts, f is a FileInfo):
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Length", f.Length.ToString());
Response.ContentType = "application/excel" // for xls files
Response.AddHeader("Content-Disposition", "inline; filename=" + f.Name);
Response.WriteFile(f.FullName);
Response.Flush();
Response.Close();
Response.End();
I am going to try different mime types as documented on filext.com but, as this is going to take a while because of physical device unavailability, if anybody has a clue I'd be glad to hear about it. I'll keep this posted if I find a solution.
Thanks.

On RIM they say you should use BES to view PDF, DOC etc
I've test it: ASP.NET site with simple < a href ="...">< /a > link to doc file + MDS simulator + 9350 device emulator. Results same as in forum topic:
Socket Channel not able to connect;
address 127.0.0.1:1900
Unfortunately can't test it on BES, but you should try it.
My opinion is BES allows to view office files with DocsToGo opened with simple links.

Actually I was a bit misguided by user's feedback: after further investigating this issue, it came out that only Excel files failed to open, not all Office files.
After changing the MIME type from "application/excel" to "application/**vnd.ms-**excel" it worked fine.

Related

Is it possible to print to a local printer with CFFILE?

I'm building an application in ColdFusion that lets the user choose a group of photos and will let them be printed automatically, however, I need to print the file and not the webpage holding the images. Is this possible with CFFILE? If not what is the best way to do this?
Dan's suggestion of an Active-X control (even if it's possible) will only work for MSIE 11 and earlier. Active-X will not work for MS Edge or any non-MS browser. It's not a global, future-proof solution.
The best solution will be to convert the images to a multi-page PDF file as TRose suggests. You will then present the file to the user to download or view in the browser. The user will have to manually print the PDF file.
Here's why: ColdFusion is a server-side applicaiton server. It crafts content that is viewable via a web browser. For security reasons, web browsers cannot automatically aceess a user's local computer(1) and therefore cannot connect to any printer connected to that computer.
(1) This is also why we can't upload files without user interaction.

Display docx or ppt in browser with ruby

I'm currently working on a intranet webapp for a company.
I've created it so the administrators of the site are able to upload files
(.docx, .pdf, .xlsx, .ppt etc) up to the webapp, to provide easier access
to documents for the employees. It works very well, however my client wasn't
too fond of having to download the files, and wanted it to pop up in the browser,
or open up the file-spesific program instead of download.
I was playing with some ideas:
1. Somehow parse the files to JSON at upload, and then show the content in browser with html.
2. Generate a pdf from the uploaded file (which automatically launches in the browser).
3. Somehow use a previewer to show the filecontent in the browser
4. Clients computer launches the uploaded file automatically on download, however I think this is a bit more tricky...
What would be the best and most time-efficient way to go about this?
It feels like what you actually want/need is a javascript document viewer (only) such as http://viewerjs.org/.

OpenERP Reports always in PDF

I'm new in OpenERP and I'm starting to know the application.
I hope you allow me to post this kind of questions on the forum.
Whenever I issue any listing or report in OpenERP, the application generates a PDF file to be opened or downloaded. Is there any way to make these listings and reports directly into a browser window so I can print them directly from the browser instead of download/open PDF files?
Thank you very much
Paulo Matos
[https://code.launchpad.net/~openerp-india/openerp-india/web_pdf_viewer-pga
You can use this module to open directly in browser.
Just copy this module to your web/addons folder of openerp web
Hope its work

Why does the content type of an uploaded excel file changes to application/octet-stream on mac in ASP MVC 4.0?

I'm having a little problem! I'm designing an asp mvc 4 application for a client which should import and process an excel file. To process the excel file I use the C# version of the NPOI framework.
My client uses mac and I use windows.
Everything works fine on windows but when my client tries it on his mac, it does not work anymore. After doing some searching I found that the content type of the uploaded file was "application/octet-stream" when uploading from mac (opposed to "application/vnd.ms-excel" when uploading from windows).
We use the exact same file, the only difference is that my clients file is saved on a mac and mine on a windows pc (we both got the same file from google docs).
It became weirder when he was experiencing the same error when he tried it on a windows pc with the file which was saved on mac.
Does anybody have an idea on what is going on? Or how I can get my NPOI processing working when the content type is "application/octet-stream"?
The browser can freely choose what content type to send. It could even send you "fluffy/bytes" if it wanted and you can't do anything about it. It appears that Safari on Mac does not know what an Excel file is so it does not send the Excel content type.
What is NPOI? Why does your application require that content type to be set? You can recognize that this is an Excel file by looking at the file extension that was posted. If neither content type not extension were posted (entirely possible) you can only guess by the file contents.

File upload has a MIME type of "application/x2x-download" - what is that?

My Rails site allows users to upload documents, I am using the attachment_fu plugin. I have a list of allowed [MIME] content types that I allow - the standard image formats, Office documents, PDF, etc. I have a user who cannot upload any PDF documents because the validation fails, looking in the logs attachment_fu thinks the MIME type is "application/x2x-download". The users browser is Firefox on Windows XP. When I try to upload the PDF myself using Firefox on OS X or Safari or IE 6/7/8 it works just fine. Seems to just be an issue with her browser.
I googled around for this MIME type and it seemingly doesnt exist.
In theory, I could ignore the MIME type that the client is telling and attempt to identify the file myself, maybe shell out to the file -b --mime-type command, but this just seems janky.
The other popular Rails attachment plugin, Paperclip, does not do the MIME identification itself and also attempts to trust the client browser.
What do you y'all think? Ignore the client and [attempt to] identify the upload myself or try to figure out why this users browser is setting a totally invalid MIME type in the first place?
Many 3rd party applications can modify the client mime type settings (I had my own adventure with Amazon's MP3 downloader app modifying mime types), so it is quite likely that your user has something similar (maybe something from x2x software).
I'd recommend sticking with mime/type as a means of communicating what is and isn't valid back to your users, with a secondary check using ruby filemagic in a validation.

Resources