Rick
|
| Posted: 06/26/2003, 7:41 AM |
|
I am trying to have a CC Studio 2.1 web page come up in Excel (also tried MS Word with same results) using PHP and MYSQL, Internet Explorer 6.0.2800.1106, Win XP development PC, and MS Excel 2000.
Tried putting the following two lines in Code in the 'After Initialize', 'On Initialize View', and 'Before Show' page events all with the same incomplete result as described below.
Header("Content-type: application/vnd.ms-excel");
Header("Content-Disposition: inline; filename=\"filex.xls\"");
If I comment out the above two lines the page comes up in the brower window fine. It is a simple grid page with no header, no footer, no navigation, so sorter, and no theme/style settings.
However with these lines added to any of the events listed above the File Download dialog box comes up ('Open' and 'Open Folder' option buttons are disabled) with following message:
"Getting File Information: 'myccspagename.php' from localhost." (So this looks like it is trying to deal wih the file
"And then another dialog box window with title 'Microsoft Internet Explorer' comes up with message:
Internet Explorer cannot download 'myccstudiopagename.php' from localhost."
"Internet Explorer was not able to open this Internet site. The requested sit is either unavailable or cannot be found. Please try again."
I reset the Excel .xls extension file association to OpenOffice.org 1.0.1 spreadsheet and still got same error message.
Before submitting this thread I decided to try in other browsers where it worked as described below:
Using Netscape 7.0 it worked. I was able to open page in Excel, Word, and changing the file association of Excel to Open Office I was able to open page in the Open Office Spreadsheet.
I was also able to save the page as an Excel file in an older trial version of Opera, ver. 6.05 - (always did like Opera better than IE). I am sure I could also output to MS Word or Open Office from Opera but did not try it.
Does anyone know why this is working in other browsers but not Internet Explorer, at least ver. 6.0.2800.1106?
At first I was thinking it may be an IIS or directory security setting issue. I also looked at my browser 'Intranet' security settings (I presume IE is smart enough to know my localhost IIS web page is from an 'Intranet' site). Security settings are pretty open with pretty much everything set at 'Enable' with a few things set at 'Prompt'.
Note:
I was trying this page output to Excel based on tutorial I found published at: http://www.rexdesign.com/ . Thanks rexdesign. Always love examples with explanation.
Rick
|
|
|
 |
rrodgers
|
| Posted: 06/26/2003, 9:04 AM |
|
Try this example and see if it has the same error on IE? http://www.sylvancomputing.com/ccs/csvexport/exportcsv.asp
If it works you can use this link to get to the example code to download it and see if it helps you get going. http://www.sylvancomputing.com/ccs/
rob
|
|
|
 |
Rick
|
| Posted: 06/26/2003, 9:45 AM |
|
Tried link http://www.sylvancomputing.com/ccs/csvexport/exportcsv.asp .
Using IE 6.0 I went to that URL. It prompted me to save file as as csv file and I was able to save the file and then open it up in Excel with IE 6.
It would also save file using Netscape and Opera. Both these browsers gave me the choice to open the file in a selected application instead of downloading. Opera did not open the file successfully. Netscape did open the file successfully but the data was not in different cells (just lumped together) instead of broken up into cells, as it did when opening the csv saved file in Excel.
I also downloaded and took at look at the CC Studio file with the example.
I think your example could be usefull depending on what one is trying to do.
I have several existing grids that I would like to easily get the data into excel. The approach I first tried lets me do that with two lines of code. That means I could use the exact same lines, not only on those grids, but any others I should need to use it on later.
I will investigate further. I think I remember getting excel output to work using Non Studio CodeCharge. I will see if I can find that.
Rick
|
|
|
 |
Rick
|
| Posted: 06/26/2003, 11:03 AM |
|
I found my problem. Code in my first post now works.
To diagnose, I first found the CodeCharge (non Studio) project where I opened pages into Excel and it also no longer worked.
Then I remembered I recently downloaded a trial copy of QuickView Plus.
When I installed QuickView Plus I chose to set it up with the option to integrate in with Internet Explorer. This was causing IE to choke using the method I was using.
I changed the QuickView Plus option to disable the integration with Internet Explorer and was able to open page as Excel or Word file using the method I originally tried. Did not try Open Office but I am sure it would also work.
Note: Thanks Rob. Also checked out http://www.sylvancomputing.com/ccs/ as Rob suggested. I will also consider using that approach in other projects. This site also has some other examples that look interesting and I will have to check out. It is great that there are sites like this with people giving their time and efforts to contribute and help out. Thanks again.
Rick
|
|
|
 |
rrodgers
|
| Posted: 06/27/2003, 9:51 AM |
|
Rick,
>>
I have several existing grids that I would like to easily get the data into excel. The approach I first tried lets me do that with two lines of code. That means I could use the exact same lines, not only on those grids, but any others I should need to use it on later.
<<
You are right is is kind of clumsy to have to do all that code for each grid. So I thunk<G> a bit and turned it into a class. The class will export directly from a grid or an sql statement.
This is the code to export from a grid
Dim x
Set x = New clsExportCSV
With x
'Set properties and add data to class here.
'.Contenttype = "something"
'.AddHeader("HeaderName","HeaderValue")
.ExportGridRecords MyGrid.Recordset
End With
Set x = Nothing
This is the code to export from a SQL statement.
sSQL = "SELECT Something from somewhere"
Set x = New clsExportCSV
With x
'Set properties and add data to class here.
'.Contenttype = "something"
'.AddHeader("HeaderName","HeaderValue")
.ExportSQLRecords DBConnection1,sSQL
End With
Set x = Nothing
You can see it in action and download the example at
www.sylvancomputing.com/ccs
rob
|
|
|
 |
Rick
|
| Posted: 06/28/2003, 11:13 AM |
|
Thank you Rob. Looks good. Great to have link and button output exmples.
When I get a chance I will try converting your examples to PHP.
Rick
|
|
|
 |
|