How to open .odt file in Twebbrowser - Delphi

Java, C++, C#, Delphi, ??? - Using the UNO bridges

How to open .odt file in Twebbrowser - Delphi

Postby dramiljas » Tue Jul 24, 2018 11:15 am

Hello,
i wont open .odt file in Twebbrowser component
I want to open the .odt file in tWebBrowser components. I'm programming in delphi.
Word document .doc file open with tWebBrowser.navigate(path). How to open openoffice text document .odt in twebBrowser component ?
If in path .doc file works fine. If in path .odt file a window appears on the screen asking if I want to open, save or quit. When I say that I open the .odt file it is opened outside the twebBrowser component.
How to open openoffice text document .odt in twebBrowser component ?
Help please,

Moved to more appropriate forum section, floris v, moderator
Windows 10, Open office 4.1.5
dramiljas
 
Posts: 3
Joined: Tue Jul 24, 2018 10:59 am

Re: How to open .odt file in Twebbrowser - Delphi

Postby floris v » Tue Jul 24, 2018 2:32 pm

See http://docwiki.embarcadero.com/Librarie ... WebBrowser - the component uses Microsoft's Shell Doc Object and Control Library (SHDOCVW.DLL). Therefore it can handle doc files if MS decided that IE should be able to display doc files. You will have to add that kind of functionality for displaying odt files - link to the UNO bridge or something like that. Hard work ahead, most likely.
MS Windows 10 - AOO 4.1.3 - LibreOffice 5.2.3.3
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 3999
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: How to open .odt file in Twebbrowser - Delphi

Postby dramiljas » Wed Jul 25, 2018 11:56 am

Thank you. Can you suggest me a component for Delphi programming language which can display an .ODT document as does TwebBrowser?
Windows 10, Open office 4.1.5
dramiljas
 
Posts: 3
Joined: Tue Jul 24, 2018 10:59 am

Re: How to open .odt file in Twebbrowser - Delphi

Postby floris v » Wed Jul 25, 2018 12:24 pm

I'm afraid not. You will have to google for that, probably, or ask it on the Delphi and Lazarus forums. You may have to adapt Lazarus code to fit Delphi, there are some differences. I haven't done any serious programming for a while now, so can't really help you further along.
MS Windows 10 - AOO 4.1.3 - LibreOffice 5.2.3.3
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
floris v
Moderator
 
Posts: 3999
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: How to open .odt file in Twebbrowser - Delphi

Postby Lupp » Wed Jul 25, 2018 3:30 pm

Disclaimer: This is a topic far off my specific interest and knowledge.

@dramiljas

-1- Independent of whether you use Delphi or whatever: Why do you expect there is a way to open text documents created with AOO or LibreOffice (.odt) in webbrowsers? Do you know one? (Without trusting a remote service for intermediary conversions?)

-2- What do you expect of your opened .odt? Shall the browser just act as a reader or shall there be editing?

-3- I found this old post: https://www.maketecheasier.com/read-odt ... e-browser/ Do you know more recent posts on the topic?

-4- Did you read https://superuser.com/questions/1182330 ... er/1182340 ?

-5- If there is access to the original AOO or LibreOffice software: Did you consider to use it for a "conversion on the fly" from .odt to .html?
On Windows 10: LibreOffice 6.1 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 1914
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: How to open .odt file in Twebbrowser - Delphi

Postby dramiljas » Thu Jul 26, 2018 12:31 pm

Thenk you all.
I just want to read the .odt file. Not to change it. I searched the internet and I did not find a solution. That's why I asked the question to this forum. I was hoping someone had an idea.
Thanks again.
Windows 10, Open office 4.1.5
dramiljas
 
Posts: 3
Joined: Tue Jul 24, 2018 10:59 am

Re: How to open .odt file in Twebbrowser - Delphi

Postby Lupp » Thu Jul 26, 2018 1:36 pm

I wouldn't trust MS, of course, but if you do (??):
There is an online service described here:
https://support.office.com/en-us/articl ... 61A104544E

That's to the effect that you can use the query-URL below to get "office documents" visualised in your browser.
Code: Select all   Expand viewCollapse view
https://view.officeapps.live.com/op/view.aspx?src=

Of course, you need in addition to append the original URL from where your document is accessible. Regarding the needs of URL syntax some special characters must be given in the "%-escaped" notation there. The "%3A%2F%2F" e.g. means "://" in the URL of my example file:
Code: Select all   Expand viewCollapse view
http%3A%2F%2Fpsilosoph.de%2FFreeOfficeForums%2FMSonlineServiceTest.odt

Glued together this gives the URL (with query part):
Code: Select all   Expand viewCollapse view
https://view.officeapps.live.com/op/view.aspx?src=http%3A%2F%2Fpsilosoph.de%2FFreeOfficeForums%2FMSonlineServiceTest.odt


You may test it by copying it into the URL line of your browser. (Without a line break, of course.)

Edit1:
As I meanwhile tested with Firefox you don't need the mentioned encoding there, at least in simple cases. For the example above also
Code: Select all   Expand viewCollapse view
https://view.officeapps.live.com/op/view.aspx?src=http://psilosoph.de/FreeOfficeForums/MSonlineServiceTest.odt
works.
On Windows 10: LibreOffice 6.1 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 1914
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany


Return to External Programs

Who is online

Users browsing this forum: No registered users and 0 guests