mrmartin1
March 23rd, 2005, 08:51 AM
Hi,
I am using CrR 9.0 that is IS5 compatible in a Unix / Linux system. I am calling a CR report I have written and exporting results (via asp) to disk / text file.
Set CrystalExportOptions = Session("oRpt").ExportOptions
ExportFileName = "Calling_Matrix.txt"
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
ExportDirectory = Path
ExportType = "8"
CrystalExportOptions.DiskFileName = ExportDirectory & ExportFileName
CrystalExportOptions.FormatType = CInt(ExportType)
CrystalExportOptions.DestinationType = CInt(1)
Session("oRpt").Export False
This works ok - but when I examine the file - I am receiving unwanted carriage returns (at least I think that is what they are) at the end of each line - resulting in the following line haveing a space on the left side (see below). Below is the code that then puts the data into a fixed format text file. Any ideas??
Private Sub DownloadFile(file)
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
strAbsFile = Server.MapPath(file)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
Response.Clear
Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
Response.CharSet = "UTF-8"
objStream.LoadFromFile(strAbsFile)
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
Else
Response.Clear
Response.Write("No such file exists.")
End If
Set objFSO = Nothing
End Sub
Oops - I almost forgot - a valid file was produced before our company switched from windows2000 to windows2003.
Thanks in Advance!!!
Mike
I am using CrR 9.0 that is IS5 compatible in a Unix / Linux system. I am calling a CR report I have written and exporting results (via asp) to disk / text file.
Set CrystalExportOptions = Session("oRpt").ExportOptions
ExportFileName = "Calling_Matrix.txt"
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
ExportDirectory = Path
ExportType = "8"
CrystalExportOptions.DiskFileName = ExportDirectory & ExportFileName
CrystalExportOptions.FormatType = CInt(ExportType)
CrystalExportOptions.DestinationType = CInt(1)
Session("oRpt").Export False
This works ok - but when I examine the file - I am receiving unwanted carriage returns (at least I think that is what they are) at the end of each line - resulting in the following line haveing a space on the left side (see below). Below is the code that then puts the data into a fixed format text file. Any ideas??
Private Sub DownloadFile(file)
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
strAbsFile = Server.MapPath(file)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
Response.Clear
Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
Response.CharSet = "UTF-8"
objStream.LoadFromFile(strAbsFile)
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
Else
Response.Clear
Response.Write("No such file exists.")
End If
Set objFSO = Nothing
End Sub
Oops - I almost forgot - a valid file was produced before our company switched from windows2000 to windows2003.
Thanks in Advance!!!
Mike