473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid --> Excel Spreadsheet - A "small detail" question

In a VB.NET application, I have a datagrid that I export to an Excel
spreadsheet like this:

' Set the content type to Excel
Response.Conten tType = "applicatio n/vnd.ms-excel"

Dim tw As New System.IO.Strin gWriter
Dim hw As New System.Web.UI.H tmlTextWriter(t w)

' Get the HTML for the control.
DataGrid1.Rende rControl(hw)

' Write the HTML back to the browser.
Response.Write( tw.ToString())

In the datagrid, I use colored backgrounds. There is a default white
background, and four other colors that I use. After exporting, the
spreadsheet only retains the white background and one of the other colors
(System.Drawing .Color.FromName ("#e38a00"). The other three colors (nothing
special - ff0000, 00ff00, ffff00 - red, green, and yellow) are lost in the
move.
Now, my questions:

- Am I supposed to be able to maintain colored cells during the move?

- If so, do you know or see anything obvious I need to do?

Thanks,

Dave


Nov 18 '05 #1
0 1029

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1080
by: Goran Djuranovic | last post by:
Hi all, When I export data from asp.net datagrid to excel spreadsheet, characters such as "é" become "é". It looks like excel doesn't know how to convert these. Anyone? TIA
2
290
by: | last post by:
I have an app with 2 datagrids that are displayed in a page_load event. I use the following code to render it to an Excel workbook. sFile = sFile.Replace("/", "-") ClearControls(DataGrid1) Select Case RbtnExport.SelectedItem.Value
2
1071
by: Rob Petersen | last post by:
Can anyone recommend a good, reliable solution or 3rd party component to send a DataGrid or DataTable's contents to Excel? I've tried the following code but it does not work reliably with large amounts of data (we have about 50,000 rows). Server.ScriptTimeout = 1000; Response.ContentType = "application/vnd.ms-excel"; Response.Charset = "";
4
2308
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the table is created then I need to fill the table with the data from that spreadsheet. I am using ASP.NET 2.0 and SQL 2000 for my database. What would be the best way to do this? Should I go Excel to XML or Excel to a Dataset?
5
1833
by: Dave | last post by:
In a VB.NET application, I have a datagrid that I export to an Excel spreadsheet like this: ' Set the content type to Excel Response.ContentType = "application/vnd.ms-excel" Dim tw As New System.IO.StringWriter Dim hw As New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control.
3
11689
by: Scott M. Lyon | last post by:
I'm trying to figure out a way to export data (actually the result of a Stored Procedure call from SQL Server) into a specified Excel spreadsheet format. Currently, I have the data read into a DataSet that consists of one DataTable. That DataTable has a specific name (for arguments purposes, let's say it's called "DataGrid"), that I need to use as the tab name in the exported Excel
0
1061
by: Leonard | last post by:
I am trying to open an excel spreadsheet that is loaded from a datagrid. I have managed to do this. But, my original .aspx page no longer works. I will try to explain. I have an .aspx page - Default.aspx, that gets loaded with an .ascx, depending on the menu item. One of the ascx controls contains a button to load my datagrid and pass it to excel. Excel opens and the spreadsheet is loaded, and that all looks ok, but, the original ascx...
0
1582
by: JLuv | last post by:
What i want to do is take the checked data from a datagrid, send it to a table, then show that table on an Excel Spreadsheet. Here is a little bit of my code... //adminProgress.aspx <asp:DataGrid ID="pGrid" runat="server" AutoGenerateColumns="false" AllowSorting="true"> <Columns> <asp:TemplateColumn HeaderText="Select"> <ItemTemplate>
4
1922
by: zacks | last post by:
I have an application that can read an Excel spreadsheet on a computer that doesn't have Excel installed on using the Jet ODBC 4.0 driver. I know need to modify the application to also be able to create a new Excel spreadsheet and write data to it on the same computer, a computer that does not have Excel, or even Office installed. I have done some research on this and it appears it cannot be done. Can anyone verify that or better...
0
1317
by: Maurita | last post by:
Hi All, hope someone can lead me in the right direction. I am in new territory and am unsure what to do after importing an Excel Spreadsheet into my database. 1. The same spreadsheet with new information will periodically be imported into the database into tblImport. 2. I've created a query to so as to separate out the three fields and criteria that I need to be incorporated into the database named qryImport.
0
9492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10360
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10163
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.