Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Beginning Visual C#
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning Visual C#
This is the forum to discuss the Wrox book Beginning Visual C#, Revised Edition of Beginning C# for .NET v1.0 by Karli Watson, David Espinosa, Zach Greenvoss, Jacob Hammer Pedersen, Christian Nagel, Jon D. Reid, Matthew Reynolds, Morgan Skinner, Eric White; ISBN: 9780764543821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old May 17th, 2009, 02:52 AM
Registered User
Join Date: May 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Having two different fonts/color within same Excel Cell

I need to Display something like this:

This is ALL in one cell

HELP - How do I do that?

The best reference I have is:

Microsoft.Office.Tools.Excel.NamedRange charactersRange;
private void FormatCharacters()
charactersRange = this.Controls.AddNamedRange(
this.Range["A1", "A1"], "charactersRange");
this.charactersRange.Value2 = "Smith";
this.charactersRange.Characters[1, 1].Font.Bold = true;
this.charactersRange.Characters[1, 1].Font.Size = 14;
From: http://msdn.microsoft.com/en-us/libr...rs(VS.80).aspx

But I can't seem to get the namespace/Reference correct....
I can change any cell to any color/font/size/alignment/ect.. even add hyperlink correctly but can't seem to get two fonts or color type in same cell.....
It's gotta lie with "NamedRange" / "Character" reference..
.just can't get it to compile or work.... PLZ help.....

Sample Working Code from my project:

((Excel.Range)oSheet.Columns["A:M", Type.Missing]).Font.Size = 9;
oSheet.get_Range("L1", "L1").Interior.ColorIndex = 15;
oSheet.get_Range("A1", "L1").EntireColumn.Borders.LineStyle = Excel.XlLineStyle.xlContinuous;
oSheet.get_Range("A:A", "L:L").VerticalAlignment = Excel.XlVAlign.xlVAlignTop;
oSheet.get_Range("A:A", "L:L").HorizontalAlignment = Excel.XlHAlign.xlHAlignLeft;
oSheet.Hyperlinks.Add(oSheet.get_Range("A" + tempRowCount, Type.Missing), tempHyperLink, Type.Missing, "Reference to:" + listView3.Items[row].SubItems[col].Text.ToString(), listView3.Items[row].SubItems[col].Text.ToString());

Last edited by tom1002; May 17th, 2009 at 05:09 PM.
Reply With Quote

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Excel Cell color populate .NET Framework 2.0 2 March 3rd, 2014 03:25 AM
Filling a Oval in a Excel Cell with Color sinajs Excel VBA 0 January 22nd, 2007 12:47 PM
Change Cell Color phungleon HTML Code Clinic 2 April 9th, 2006 12:36 AM
Listview Cell Color leontun Pro VB 6 2 December 15th, 2004 03:14 PM
Fill color in Excel Cell Anantsharma Excel VBA 14 October 25th, 2004 07:11 AM

All times are GMT -4. The time now is 03:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.