Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7)
xlRG.Font.Bold = True
xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there
is no constant vbRed and Color.Red gives an invalid format. Is there a set of
enumerations of colors that will work here? 10 30593
Darrell,
I am in doubt if it is the same colourcode as the Interop wants, however a
colour in VBNet is just easy to get with Color.Red (it is a enum so a bunch
of colours is showed)
I hope this helps?
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there is no constant vbRed and Color.Red gives an invalid format. Is there a set of enumerations of colors that will work here?
Hi xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
Excel-Workbook:
xlWB.Colors(1) = RGB(255,255,255)
xlWB.Colors(2) = RGB(225,225,225)
xlWB.Colors(3) = RGB(200,200,200)
Excel-Worksheet
xlWS.Range("A1:A30").Interior.ColorIndex = 1
xlWS.Range("B1:B30").Interior.ColorIndex = 2
xlWS.Range("C1:C30").Interior.ColorIndex = 3
This works fine for me
Frank
"Darrell Wesley" <Da***********@discussions.microsoft.com> wrote in message news:<33**********************************@microso ft.com>... Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there is no constant vbRed and Color.Red gives an invalid format. Is there a set of enumerations of colors that will work here?
Hi Darrell,
What was the exact message? May it is a casting problem.
TTH,
Adel A. Al-saleh
Finally found out how to do this:
xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed)
and to set the cell background color
xlRG.Interior.Color =
System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue)
xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid
"Darrell Wesley" wrote: Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there is no constant vbRed and Color.Red gives an invalid format. Is there a set of enumerations of colors that will work here?
Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence
of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> Finally found out how to do this:
xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed)
and to set the cell background color
xlRG.Interior.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid
"Darrell Wesley" wrote:
Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there is no constant vbRed and Color.Red gives an invalid format. Is there a set of enumerations of colors that will work here?
YES.
If you try to set the ColorIndex property you will get an error.
Take a look at this http://msdn.microsoft.com/library/de...l/ExcelObj.asp
"Cor Ligthert" wrote: Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color
http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> Finally found out how to do this:
xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed)
and to set the cell background color
xlRG.Interior.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid
"Darrell Wesley" wrote:
Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range
xlRG = xlWS.Cells(row, 7) xlRG.Font.Bold = True xlRG.Font.Color = 255
In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net there is no constant vbRed and Color.Red gives an invalid format. Is there a set of enumerations of colors that will work here?
Darell,
Thanks for the page, however there it is not described as you did it.
Colorconverter is a method from system.drawing not from
system.drawing.color.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> YES.
If you try to set the ColorIndex property you will get an error.
Take a look at this
http://msdn.microsoft.com/library/de...l/ExcelObj.asp
"Cor Ligthert" wrote:
Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color
http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> > Finally found out how to do this: > > xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed) > > and to set the cell background color > > xlRG.Interior.Color = > System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) > xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid > > "Darrell Wesley" wrote: > >> Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range >> >> >> xlRG = xlWS.Cells(row, 7) >> xlRG.Font.Bold = True >> xlRG.Font.Color = 255 >> >> In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net >> there >> is no constant vbRed and Color.Red gives an invalid format. Is there a >> set of >> enumerations of colors that will work here?
Darell,
Thanks for the page, however there it is not described as you did it.
Colorconverter is a method from system.drawing not from
system.drawing.color.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> YES.
If you try to set the ColorIndex property you will get an error.
Take a look at this
http://msdn.microsoft.com/library/de...l/ExcelObj.asp
"Cor Ligthert" wrote:
Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color
http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> > Finally found out how to do this: > > xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed) > > and to set the cell background color > > xlRG.Interior.Color = > System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) > xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid > > "Darrell Wesley" wrote: > >> Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range >> >> >> xlRG = xlWS.Cells(row, 7) >> xlRG.Font.Bold = True >> xlRG.Font.Color = 255 >> >> In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net >> there >> is no constant vbRed and Color.Red gives an invalid format. Is there a >> set of >> enumerations of colors that will work here?
You are so right. Thanks.
"Cor Ligthert" wrote: Darell,
Thanks for the page, however there it is not described as you did it.
Colorconverter is a method from system.drawing not from system.drawing.color.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com>
YES.
If you try to set the ColorIndex property you will get an error.
Take a look at this
http://msdn.microsoft.com/library/de...l/ExcelObj.asp
"Cor Ligthert" wrote:
Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color
http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> > Finally found out how to do this: > > xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed) > > and to set the cell background color > > xlRG.Interior.Color = > System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) > xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid > > "Darrell Wesley" wrote: > >> Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range >> >> >> xlRG = xlWS.Cells(row, 7) >> xlRG.Font.Bold = True >> xlRG.Font.Color = 255 >> >> In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net >> there >> is no constant vbRed and Color.Red gives an invalid format. Is there a >> set of >> enumerations of colors that will work here?
You are so right. Thanks.
"Cor Ligthert" wrote: Darell,
Thanks for the page, however there it is not described as you did it.
Colorconverter is a method from system.drawing not from system.drawing.color.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com>
YES.
If you try to set the ColorIndex property you will get an error.
Take a look at this
http://msdn.microsoft.com/library/de...l/ExcelObj.asp
"Cor Ligthert" wrote:
Darrel,
Thanks for sending this feed back.
However I did not understand why I had not seen it before in the intelisence of the color and searched for it on MSDN.
And than I saw this. http://msdn.microsoft.com/library/de...ToOleTopic.asp
And not as a method of color
http://msdn.microsoft.com/library/de...mberstopic.asp
Therefore are you sure that it works as you describe it.
Cor
"Darrell Wesley" <Da***********@discussions.microsoft.com> > Finally found out how to do this: > > xlRG.Font.Color = System.Drawing.Color.ColorTranslator.ToOle(Color.R ed) > > and to set the cell background color > > xlRG.Interior.Color = > System.Drawing.Color.ColorTranslator.ToOle(Color.L ightBlue) > xlRG.Interior.Pattern = Excel.XlPattern.xlPatternSolid > > "Darrell Wesley" wrote: > >> Where xlWs is an Excel.Worksheet and xlRG is an Excel.Range >> >> >> xlRG = xlWS.Cells(row, 7) >> xlRG.Font.Bold = True >> xlRG.Font.Color = 255 >> >> In VB6 you could just simply say xlRG.Font.Color = vbRed but in .net >> there >> is no constant vbRed and Color.Red gives an invalid format. Is there a >> set of >> enumerations of colors that will work here? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: stainless |
last post by:
I am currently designing a .NET system that takes a piece of text from
a SQL Server database (this is
variable), writes it to an excel spreedsheet in a cell of known length
and height (in...
|
by: Adam |
last post by:
Can someone please help!!
I am trying to figure out what a font is?
Assume I am working with a fixed font say Courier 10 point font
Question 1: What does this mean 10 point font
Question 2:...
|
by: DraguVaso |
last post by:
Hi,
I'm looking for a nice way to format the cell of my datagrid according to
some predefined 'rules'. I found a lot on the site of George shepherd, but
it wasn't really what I was looking for:...
|
by: vincent.boilay |
last post by:
Hi all,
in very simple Excel Com Add-in, I want to change the font of the given
range by using Font->set_Bold(true). Unfortunately, I do not ga that
far. It throws when I do get_Font().
Object*...
|
by: CoolFactor |
last post by:
MY CODE IS NEAR THE BOTTOM
I want to export this Access query into Excel using a command button on an Access form in the following way I describe below.
Below you will find the simple query I am...
|
by: patrick.waldo |
last post by:
Hi all,
I am trying to figure out a way to read colors with xlrd, but I did
not understand the formatting.py module. Basically, I want to sort
rows that are red or green. My initial attempt...
|
by: Marin Brkic |
last post by:
Hello all,
please, let me apologize in advance. English is not my first language
(not even my second one), so excuse any errors with which I'm about to
embarass myself in front of the general...
|
by: hemantbasva |
last post by:
Note We need to have a template on server for generating report in multiple sheet
as we do not had msoffice on server
moreover this require a batch job to delete excel file created by the...
|
by: ravir81 |
last post by:
Hi,
I am working on excel reporting using Perl. I am facing problem with writing the header part only once for all the excels created using Perl.
Here is the code :
...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
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...
|
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,...
|
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...
| |