Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Beginning Visual C#
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
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:


Code:
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:

Code:
 
((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..





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Excel Cell color populate .NET Framework 2.0 2 March 3rd, 2014 04:25 AM
Filling a Oval in a Excel Cell with Color sinajs Excel VBA 0 January 22nd, 2007 01: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 04:14 PM
Fill color in Excel Cell Anantsharma Excel VBA 14 October 25th, 2004 07:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.