AndersonCJA
Programmer
Objective: Define excel columns while using an asp page to open a crystal report in an excel file neatly.
The report is created in Crystal version 11. The report is formated for the purpose of exporting to excel. For example, in the File options, snap to grid is selected, free form is unselected, grid size is 50. To place the fields properly, the view size was expanded to 200-300 and the fields were positioned to land on a grid line. There are no grid lines in-between the fields.
Also, in the same Crystal report
File - Export- Report export options - Select export options to set default options is set at:
Microsoft excel 97-2000
Column width is based on objects in the page header
The report exports perfect to excel when exporting it directly from the crystal report but not from a web page.
I have an asp page that will display the report in a web browser. When I call the report using the asp, the report opens in excel, but it looks messy with extra columns.
I am new at asp but it seems as though something could be added in this portion of the code to describe the column length:
if viewer = "Excel" then
exporttype = "3"
fileextension = ".xls"
end if
More of the asp (but not the whole asp because it is really lengthy).
<% viewer = "Excel" %>
<%
if
if viewer = "Excel" then
exporttype = "3"
fileextension = ".xls"
end if
%>
<%
set crystalExportOptions = Session("oRpt").ExportOptions
ExportFileName = "Report name -" & CStr(Session.SessionID) & fileextension
ExportDirectory = basePath
if viewer<>"HTML" then
crystalExportOptions.DiskFileName = basepath & ExportFileName
end if
crystalExportOptions.FormatType = CInt(exporttype)
crystalExportOptions.DestinationType = 1
Session("oRpt").Export False
Set Session("oPageEngine") = Nothing
Set Session("oRpt") = Nothing
'Set Session("oApp") = Nothing
response.write "<META http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) & "0; url=" & basevirtualpath & exportfilename & Chr(34) & ">"
'clean up files that are more than 1 day old
set objFS = CreateObject("Scripting.FileSystemObject")
set objFC = objFS.GetFolder( Left( basePath, ( len( basePath ) - 1) ) )
set objF = objFC.Files
for each Item in objF
testfilename = UCase(Item.Name)
testextension = UCase(right(testfilename,4))
end if
end if
next
%>
Thank you
The report is created in Crystal version 11. The report is formated for the purpose of exporting to excel. For example, in the File options, snap to grid is selected, free form is unselected, grid size is 50. To place the fields properly, the view size was expanded to 200-300 and the fields were positioned to land on a grid line. There are no grid lines in-between the fields.
Also, in the same Crystal report
File - Export- Report export options - Select export options to set default options is set at:
Microsoft excel 97-2000
Column width is based on objects in the page header
The report exports perfect to excel when exporting it directly from the crystal report but not from a web page.
I have an asp page that will display the report in a web browser. When I call the report using the asp, the report opens in excel, but it looks messy with extra columns.
I am new at asp but it seems as though something could be added in this portion of the code to describe the column length:
if viewer = "Excel" then
exporttype = "3"
fileextension = ".xls"
end if
More of the asp (but not the whole asp because it is really lengthy).
<% viewer = "Excel" %>
<%
if
if viewer = "Excel" then
exporttype = "3"
fileextension = ".xls"
end if
%>
<%
set crystalExportOptions = Session("oRpt").ExportOptions
ExportFileName = "Report name -" & CStr(Session.SessionID) & fileextension
ExportDirectory = basePath
if viewer<>"HTML" then
crystalExportOptions.DiskFileName = basepath & ExportFileName
end if
crystalExportOptions.FormatType = CInt(exporttype)
crystalExportOptions.DestinationType = 1
Session("oRpt").Export False
Set Session("oPageEngine") = Nothing
Set Session("oRpt") = Nothing
'Set Session("oApp") = Nothing
response.write "<META http-equiv=" & Chr(34) & "Refresh" & Chr(34) & " content=" & Chr(34) & "0; url=" & basevirtualpath & exportfilename & Chr(34) & ">"
'clean up files that are more than 1 day old
set objFS = CreateObject("Scripting.FileSystemObject")
set objFC = objFS.GetFolder( Left( basePath, ( len( basePath ) - 1) ) )
set objF = objFC.Files
for each Item in objF
testfilename = UCase(Item.Name)
testextension = UCase(right(testfilename,4))
end if
end if
next
%>
Thank you