irfan1977 0 Newbie Poster

I want to create an excel file from classical ASP. My client is Win 7 / IE9, Server has Windows Server 2003 and Excel 2003

Response.ContentType = "application/; charset=utf-8"
Response.AddHeader "Content-Disposition", "attachment; filename=abc.xls"

AT first It worked but later on the file corrupted. While opening the file in excel and import job too we are getting error saying "The file you are trying to open <filename> is in different format than specified bt file extension. Verify that the file is from a trusted source before opening the file. Do you want to open the file now ?"
I tried different types of the followings, but I could not solve.

Then I changed my way to create excel file using Excel.Application

I am creating excel file on the Server from classical ASP using Excel.Application
In the file, I can not see Turkish characters normally.
For example İ is seen like Ä°.

Can anyone help me ? I used the followings :

        'Session.LCID = 1055
        'Session.CodePage = 1254

        'Response.ContentEncoding = Server.Encoding.GetEncoding(1254)
        'Response.ContentEncoding = "windows-1254"

        Set objExcel = CreateObject("Excel.Application")
        objExcel.Visible = False
        objExcel.DisplayAlerts = False
        'objExcel.DefaultWebOptions.Encoding = 28599
        objExcel.DefaultWebOptions.AlwaysSaveInDefaultEncoding = True
        Set objWorkbook = objExcel.Workbooks.Add()
        'Set objWorkbook = objExcel.Workbooks.Add
        objExcel.DefaultWebOptions.AlwaysSaveInDefaultEncoding = True
        Set objSpreadsheet = objWorkbook.Worksheets(1)
        'objSpreadsheet.Cells(1, 1).Select
        objSpreadsheet.Cells(1, 1) = "ıışşç"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.