Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 2nd, 2007, 08:00 PM
Authorized User
 
Join Date: Aug 2007
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yukijocelyn
Default Extra redundant row after export to excel

Hi

I'm experiencing a slight problem here. I'm exporting my GridView data into excel, but the first row is usually filled with 2 redundant characters. Please help me have a look at it, is there anything wrong with this piece of code? Thank you!

Dim sw As New StringWriter
        Dim htw As New HtmlTextWriter(sw)

        Me.GridView1.RenderControl(htw)
        Dim strHtml As String = sw.ToString.Trim

        Dim ExcelFileName As String = "New Employee Email Details.xls"
        Dim FilePhysicalPathName = Request.PhysicalApplicationPath
        Dim objectExcelFileName As String = Path.Combine(FilePhysicalPathName, ExcelFileName)
        If File.Exists(objectExcelFileName) Then
            File.Delete(objectExcelFileName)
        End If
        Dim fs As New FileStream(objectExcelFileName, FileMode.Create)
        Dim bw As New BinaryWriter(fs, Encoding.Default)
        bw.Write(strHtml)
        bw.Close()
        fs.Close()





Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel lathika ASP.NET 2.0 Basics 6 July 24th, 2008 05:43 AM
BindingNavigator show 2 extra when add new row michellebong Visual Basic 2005 Basics 1 March 28th, 2008 10:22 PM
export to excel roy_mm Reporting Services 0 September 2nd, 2006 11:53 PM
Export to Excel pramesh_it ASP.NET 1.0 and 1.1 Basics 1 April 4th, 2006 09:04 AM
Export to Excel rweide Classic ASP Basics 5 February 23rd, 2005 09:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.