Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net
Format Excel in vb.net Format Excel in vb.net
Format Excel in vb.net
Go Back  Xtreme Visual Basic Talk > > > Format Excel in vb.net


Reply
 
Thread Tools Display Modes
  #1  
Old 12-14-2010, 02:08 PM
moumona moumona is offline
Newcomer
 
Join Date: Aug 2006
Posts: 13
Default Format Excel in vb.net


I want to format the output which is execel. I need to change the font style and back ground colors fo the first row. Can someone help me with this please?
I tried playing around with the data grid and data set but no results.

This is my code:

Code:
Private Sub Convert(ByVal ds As DataSet, ByVal sParams As String, ByVal response As HttpResponse)
		'first let's clean up the response.object
		response.Clear()
		response.Charset = ""

		'set the response mime type for excel
		response.ContentType = "application/vnd.ms-excel"

		'output report title and search parameters
        response.Write("<table border='0' align='left'><tr><td style='color:white;text-align:center' colspan='12' bgColor='#3366FF'><b>classic Rpt</b></td></tr>")
        response.Write("<tr><td colspan='8'><b>" & sParams & "<b></td></tr></table><p>")

		'create a string writer
		Dim stringWrite As New System.IO.StringWriter()

		'create an htmltextwriter which uses the stringwriter
		Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)

		'instantiate a datagrid
        Dim dg As New DataGrid()
        
        'set the datagrid datasource to the dataset passed in
        dg.DataSource = ds.Tables(0)

        'bind the datagrid
        dg.DataBind()


        'tell the datagrid to render itself to our htmltextwriter
        dg.RenderControl(htmlWrite)

        'all that's left is to output the html
        response.Write(stringWrite.ToString)
        response.End()
    End Sub
Thnx in advance
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net Format Excel in vb.net
Format Excel in vb.net
Format Excel in vb.net
 
Format Excel in vb.net
Format Excel in vb.net
 
-->