Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to copy Datagridview Backcolors to Excel

Posted on 2009-05-07
4
Medium Priority
?
383 Views
Last Modified: 2012-06-27
Is there a good way to transfer the backcolor of a Datagridview to Excel using Vb.net? I have working code but it's very slow.
For intTube = 1 To intTubeCount
                            GetActiveChild.tspbThicknessData.Value = GetActiveChild.tspbThicknessData.Value + 1
                            If GetActiveChild.dgvThicknessData.Rows.Item(intRow + 2).Cells(Y + intTube).Value = "" Then
                                .Cells(X, Y + 1 + intTube).Interior.Color = System.Drawing.ColorTranslator.ToOle(Color.White)
                        Else
                            If GetActiveChild.dgvThicknessData.Rows.Item(intRow + 2).Cells(Y + intTube).Style.BackColor <> Color.White Then
                                If .Cells(X, Y + 1 + intTube).Interior.Color <> System.Drawing.ColorTranslator.ToOle(GetActiveChild.dgvThicknessData.Rows.Item(intRow + 2).Cells(Y + intTube).Style.BackColor) Then
                                    .Cells(X, Y + 1 + intTube).Interior.Color = System.Drawing.ColorTranslator.ToOle(GetActiveChild.dgvThicknessData.Rows.Item(intRow + 2).Cells(Y + intTube).Style.BackColor)
                                End If
                            End If
                        End If
                            ThicknessReadings(intRow + 2, intTube - 1) = GetActiveChild.dgvThicknessData.Rows.Item(intRow + 2).Cells(Y + intTube).Value
                        Next

Open in new window

0
Comment
Question by:murr1999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24337241
There is the Open XML way, but that depends on the Excel version that you are using...
0
 

Author Comment

by:murr1999
ID: 24337700
Can you provide some sample code for this?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 24337749
Oh, I wish...

There are plenty of references, like this one, for the SpreadsheetML Open XML specification:

ExcelPackage: Office Open XML Format file creation
http://www.codeplex.com/ExcelPackage
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question