plq
asked on
Associate a File to an Application for IE launch
In IE I have a link such as this..
<a href="reports/myreport.rpx ">Click to Edit Report</a>
Then I have associated rpx on my PC with a program, from using open with and ticking the always.. box.
But IE still opens the file in an IE window
Is there anyway to force the machine to open the file using a program of my choice ?
I'm hoping its just a reg setting, but I couldn't find it. Access to the clients registry is not a problem for this application, since the report editor will be preinstalled from a setup program.
<a href="reports/myreport.rpx
Then I have associated rpx on my PC with a program, from using open with and ticking the always.. box.
But IE still opens the file in an IE window
Is there anyway to force the machine to open the file using a program of my choice ?
I'm hoping its just a reg setting, but I couldn't find it. Access to the clients registry is not a problem for this application, since the report editor will be preinstalled from a setup program.
ASKER
There is no mime type. The rpx file actually contains XML (active reports from data dynamics)
I have control over the app on the client that opens the rpx file (i.e. I have the source code in vb.net).
I don't know how i would tell the browser its a different mime type. Its opened with js:
window.open(sfile, "reporteditor");
The web behind is standard asp - I suppose I could say
window.open("rpxlaunch.asp ?file=" + sfile, "reporteditor");
and in rpxlaunch.asp ...
response.contenttype = "text/mymimetype" ?
response.write ReadTextFile(Request.Query String("fi le"))
How does that sound?
Here's a typical rpx file
<?xml version="1.0" encoding="UTF-8"?>
<ActiveReportsLayout Version="3" PrintWidth="14535" DocumentName="sysAssetRegi sterByCate gory" ScriptLang="C#" ShowParamUI="0" CodeFile="sysTest.vb">
<StyleSheet>
<Style Name="Normal" Value="font-family: 'Arial'; font-style: normal; font-variant: inherit; font-weight: normal; font-size: 10pt; font-size-adjust: inherit; font-stretch: inherit; color: rgb(0,0,0); background-color: inherit; background-image: inherit; background-repeat: inherit; background-attachment: inherit; opacity: inherit; word-spacing: inherit; letter-spacing: inherit; text-decoration: none; vertical-align: inherit; text-transform: inherit; text-align: inherit; text-indent: inherit; unicode-bidi: inherit; line-height: inherit; white-space: inherit; ddo-char-set: 0; " />
<Style Name="Heading1" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit; " />
<Style Name="Heading2" Value="font-family: 'Times New Roman'; font-style: italic; font-variant: inherit; font-weight: bold; font-size: 14pt; font-size-adjust: inherit; font-stretch: inherit; " />
<Style Name="Heading3" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 13pt; font-size-adjust: inherit; font-stretch: inherit; " />
</StyleSheet>
<Sections>
<Section Type="Detail" Name="Detail" Height="254" BackColor="16777215" KeepTogether="1" CanGrow="0">
<Control Type="AR.Field" Name="txtCompanyCompanyDes c18" DataField="CostCentreName" MOD="4" Left="0" Top="0" Width="2000" Height="235" Text="CostCentreName" Style="color: rgb(0,0,0); ddo-char-set: 0; text-align: left; background-color: rgb(255,255,255); font-size: 8pt; " />
</Section>
</Sections>
<PageSettings />
</ActiveReportsLayout>
I have control over the app on the client that opens the rpx file (i.e. I have the source code in vb.net).
I don't know how i would tell the browser its a different mime type. Its opened with js:
window.open(sfile, "reporteditor");
The web behind is standard asp - I suppose I could say
window.open("rpxlaunch.asp
and in rpxlaunch.asp ...
response.contenttype = "text/mymimetype" ?
response.write ReadTextFile(Request.Query
How does that sound?
Here's a typical rpx file
<?xml version="1.0" encoding="UTF-8"?>
<ActiveReportsLayout Version="3" PrintWidth="14535" DocumentName="sysAssetRegi
<StyleSheet>
<Style Name="Normal" Value="font-family: 'Arial'; font-style: normal; font-variant: inherit; font-weight: normal; font-size: 10pt; font-size-adjust: inherit; font-stretch: inherit; color: rgb(0,0,0); background-color: inherit; background-image: inherit; background-repeat: inherit; background-attachment: inherit; opacity: inherit; word-spacing: inherit; letter-spacing: inherit; text-decoration: none; vertical-align: inherit; text-transform: inherit; text-align: inherit; text-indent: inherit; unicode-bidi: inherit; line-height: inherit; white-space: inherit; ddo-char-set: 0; " />
<Style Name="Heading1" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 16pt; font-size-adjust: inherit; font-stretch: inherit; " />
<Style Name="Heading2" Value="font-family: 'Times New Roman'; font-style: italic; font-variant: inherit; font-weight: bold; font-size: 14pt; font-size-adjust: inherit; font-stretch: inherit; " />
<Style Name="Heading3" Value="font-family: 'inherit'; font-style: inherit; font-variant: inherit; font-weight: bold; font-size: 13pt; font-size-adjust: inherit; font-stretch: inherit; " />
</StyleSheet>
<Sections>
<Section Type="Detail" Name="Detail" Height="254" BackColor="16777215" KeepTogether="1" CanGrow="0">
<Control Type="AR.Field" Name="txtCompanyCompanyDes
</Section>
</Sections>
<PageSettings />
</ActiveReportsLayout>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This is working now. I can now open an rpx straight into my vb.net editor
Here's the JS
window.open("reportedit.as p?file=" + sfile, "reporteditor")
Here's the reportedit.asp page (asp3 sadly)
<%
Response.ContentType = "application/rpx"
sFile = Request.QueryString("file" )
Response.Write ReadTextFile(Server.MapPat h(".") & "\" & Replace(sFile, "/", "\"), 0)
Function ReadTextFile(sName, bUnicode)
Dim scr
Dim txt
Dim sBuffer
Dim lCount
Set scr = CreateObject("Scripting.Fi leSystemOb ject")
Set txt = scr.OpenTextFile(CStr(sNam e), 1, false, CBool(bUnicode))
If txt.AtEndOfStream Then
ReadTextFile = ""
Else
ReadTextFile = txt.ReadAll()
End If
txt.Close
Set txt = Nothing
Set scr = Nothing
End Function
%>
And here's the reg file needed on the client... this reg setting seems to make it use the windows default for rpx (e.g. open from windows explorer file association), which is just what I wanted
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\MIME\Da tabase\Con tent Type\application/rpx]
"Extension"=".rpx"
I am fairly sure this will be of interest to other activereports enduserdesigner developers :)
thanks for helping
Here's the JS
window.open("reportedit.as
Here's the reportedit.asp page (asp3 sadly)
<%
Response.ContentType = "application/rpx"
sFile = Request.QueryString("file"
Response.Write ReadTextFile(Server.MapPat
Function ReadTextFile(sName, bUnicode)
Dim scr
Dim txt
Dim sBuffer
Dim lCount
Set scr = CreateObject("Scripting.Fi
Set txt = scr.OpenTextFile(CStr(sNam
If txt.AtEndOfStream Then
ReadTextFile = ""
Else
ReadTextFile = txt.ReadAll()
End If
txt.Close
Set txt = Nothing
Set scr = Nothing
End Function
%>
And here's the reg file needed on the client... this reg setting seems to make it use the windows default for rpx (e.g. open from windows explorer file association), which is just what I wanted
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\MIME\Da
"Extension"=".rpx"
I am fairly sure this will be of interest to other activereports enduserdesigner developers :)
thanks for helping
To make it open in the correct program on the client machine will require you to stream the report to the browser with the correct mime type.
You can find a mime type that the client machine wants for .rpx by checking the file association on the local computer. (HKEY_CLASSES_ROOT).
If there is no mime type, or the mime type is used someplace else, e.g. text/plain, you probably won't be able to do what you want. If it has a unique mime type, then you can change the mime type of your response from the web site to make it open in the default application.
What is the mime type (if any)?