| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 Last edited by mrmartin1; March 24th, 2005 at 08:28 AM. |
|
#2
|
|||
|
|||
|
Re: Export to text file - format error
Hi..
I am also facing the same problem. In my project I wanted to export Crystal report t a text file. But to my surprise after export the alignment was totally collapsed. After a lot of googling I came to understand that text alignment is not possible . Crystal report is aligning the report to the maximum limit it can. The alignmrnt problem will be comming only for text format. If U r opening the file in Word pad or rtf the content will be aligned properly. the below link explains the same http://www.sourcecodesworld.com/faqs...eports-faq.asp Hope this information is helpful to U..If U got any method to solve pls tell me. With regards Biju. |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|