Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: view xlsx in web browser

Permlink Replies: 1 - Last Post: May 25, 2016 10:40 PM Last Post By: Daniel Fields
Rick Howitt

Posts: 5
Registered: 2/22/04
view xlsx in web browser
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 25, 2016 2:55 PM
I have an intraweb application that has links to pdf, xlsx, xls and cvs files. When these links are click I am trying to get the files viewed in a web page. The PDF links are working.

I am using XE5,and Intrawweb XIV .

I have Registered mimetypes for the file types that are not previously defined:
TIWMimeTypes.RegisterType('.xls', 'application/', True);
TIWMimeTypes.RegisterType('.xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', True);
TIWMimeTypes.RegisterType('.tif', 'image/tif', True);
TIWMimeTypes.RegisterType('.csv', 'text/csv', True);

I am creating a TempCacheFile and saving the file to be viewed to this file.
xFileName := TIWAppCache.NewTempFileName;
copyfile(pchar(FileToShow), pchar(xFileName),True);

I then figure out the mimeType and add the file to the Cache and pass the URL to a TIWURLWindow (PDFWindow ).
PDFurl := TIWAppCache.AddFileToCache(WebApplication, xFileName,
mimeTypeStr, ctSession);

As I said the PDF works correctly, xls, xlsx , etc do not.

When I look at the web page produced, the PDF has an iframe that is filled in with the correct content.
For xls and xlsx the iframe is basically empty.

What am I missing in my code?

Daniel Fields

Posts: 622
Registered: 11/29/04
Re: view xlsx in web browser
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 25, 2016 10:40 PM   in response to: Rick Howitt in response to: Rick Howitt
In short, I do not believe you can do that. At one point you could do it if MS Office was installed on the server. Microsoft shut that down in 2004. They licensed some browser technology to two companies after that. For $400 you could get a license to a DLL, per machine. Now that is dead because MS is offering online versions of the Office suite.

Their new strategy is 100% cross platform, and multi-device. They are making major deals by offering exactly what you seek. They have licensed DropBox and a few other cloud providers the ability to view and edit Office documents in the browser.

They are telling users to use the HTML publishing tools inside Excel to produce a file that can be viewed on the browser. If you use OneDrive, you can publish links to Office documents stored on that service. They are also pushing Office 365, which has publishing features that allow viewing and editing. Here is an example of what they want you to use: The bottom line is that they are protecting their primary revenue stream.

I have heard of jQuery spreadsheets, but have not investigated their capabilities. I doubt they are able to provide 100% compatibility. I have also read that you can embed Excel sheets if they are stored in Google Docs, which means they are paying Microsoft for you to have the feature.
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02