Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3754150
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:30:04+00:00 2026-05-19T09:30:04+00:00

iam doing export functionality in asp.net1.1…. I want to highlight some records in red

  • 0

iam doing export functionality in asp.net1.1….
I want to highlight some records in red color when i export to excel…
following is my code to export records in excel but i want some records in red colors…
So how to do this plz help me out.

Public Shared Sub ExportToExcelInvitee(ByVal query As String, _
                                       ByRef Response As System.Web.HttpResponse, _
                                       Optional ByVal exportDataset As DataSet = Nothing)
        Dim index As Integer
        Dim colIndex As Integer
        Dim columnCount As Integer
        Dim excelDataSet As DataSet
        Dim cnt As Integer

        Const PROC As String = CLASSNAME & ".ExportToExcelInvitee"
        Try

            If IsNothing(exportDataset) Then
                excelDataSet = ExecuteDataset(query)
            Else
                excelDataSet = exportDataset
            End If

            If Not IsNothing(excelDataSet) Then
                If excelDataSet.Tables(0).Rows.Count <> 0 Then

                    Response.Clear()
                    Response.ContentType = "application/vnd.ms-excel"
                    Response.Charset = ""
                    Response.AddHeader("Content-Disposition", "attachment; filename=List.xls")

                    Response.Write("<TABLE border=1>")
                    Response.Write("<TR>")
                    Response.Write("<TD><DIV align=center><B>Sr. No.</B></DIV></TD>")
                    columnCount = excelDataSet.Tables(0).Columns.Count - 1
                    For index = 2 To columnCount

                        Response.Write("<TD>" & _
                                          "<DIV align=center>" + _
                                                "<B>" & excelDataSet.Tables(0).Columns(index).ColumnName.ToString & "</B>" + _
                                          "</DIV>" & _
                                       "</TD>")

                    Next
                    Response.Write("</TR>")
                    Response.Write("<TR>")
                    ' Loop to leave one empty line after header, 
                    ' Loopimg to add the TD with black boders which doens not get added if only TR added
                    For index = 2 To columnCount
                        Response.Write("<TD></TD>")
                    Next
                    Response.Write("</TR>")

                    cnt = 1
                    For index = 0 To excelDataSet.Tables(0).Rows.Count - 1
                        If Not (excelDataSet.Tables(0).Rows(index).RowState = DataRowState.Deleted) Then

                            Response.Write("<TR>")
                            Response.Write("<TD>" & _
                                              "<DIV align=left>" & _
                                                  (cnt).ToString() & _
                                              "</DIV>" & _
                                            "</TD>")
                            For colIndex = 2 To columnCount

                                Response.Write("<TD valign=top>" & _
                                                  "<DIV align=left>" & _
                                                       excelDataSet.Tables(0).Rows(index).Item(colIndex).ToString() & _
                                                  "</DIV>" & _
                                               "</TD>")

                            Next
                            Response.Write("</TR>")
                            cnt = cnt + 1
                        End If
                    Next
                    Response.Write("</TABLE>")
                    Response.End()

                End If 'DataSet must contain data
            End If 'DataSet must contain data

        Catch ex As Exception
            Call ErrorLog(PROC & ", " & ex.Source, ex.Message)
        End Try

    End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:30:04+00:00Added an answer on May 19, 2026 at 9:30 am

    In your case, that would be simply:

    <TD style='color: red'>Some value</TD>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing an e-commerce solution in ASP.NET which uses PayPal's Website Payments Standard
I am doing some research on Unicode for a white-paper I am writing. Does
I am doing .net programming in addition to c and c++ development and want
I am doing some simple sanity validation on various types. The current test I'm
I am doing an Financial Winforms application and am having some trouble with the
I am doing some calculations that require a large array to be initialized. The
I am doing a BHO (extension for IE) that receives events on other thread.
I am doing 2nd year computer science and we have a software engineering group
I am doing 2^1000 and I am getting this: 1.07151e+301 Is there any way
I am doing my best to design my web app with good separation between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.