473,386 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Writing Varying-Font Text to an RTF File

From VB.NET, I need to write text to an RTF file, where most of it is words
in one font like arial, but a couple of individual characters along the way
are of a different font, e.g. a solid diamond from the ZapfDingbats font or
a square from the GeographicSymbols font. So it needs to switch fonts four
times along the way.

Does anyone know how this can be done in VB.NET? Thanks.
Nov 21 '05 #1
2 6503

You can use the RichTextBox object to create the file. Check out the Select
method, the SelectionFont property and the SaveFile method.

Brian Davis
http://www.knowdotnet.com
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
From VB.NET, I need to write text to an RTF file, where most of it is words in one font like arial, but a couple of individual characters along the way are of a different font, e.g. a solid diamond from the ZapfDingbats font or a square from the GeographicSymbols font. So it needs to switch fonts four times along the way.

Does anyone know how this can be done in VB.NET? Thanks.

Nov 21 '05 #2

Here's a quick example:

Dim rtb As New RichTextBox
rtb.Text = "This is alpha - a."
rtb.SelectAll()
rtb.SelectionFont = New Font(New FontFamily("Arial"), 12, FontStyle.Regular,
GraphicsUnit.Pixel)
rtb.Select(16, 1)
rtb.SelectionFont = New Font(New FontFamily("Symbol"), 12,
FontStyle.Regular, GraphicsUnit.Pixel)
rtb.SaveFile("test.rtf")
Brian Davis
http://www.knowdotnet.com

"Brian Davis" <br***@knowdotnet.nospam.com> wrote in message
news:uN*************@TK2MSFTNGP11.phx.gbl...

You can use the RichTextBox object to create the file. Check out the Select method, the SelectionFont property and the SaveFile method.

Brian Davis
http://www.knowdotnet.com
"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:uf**************@TK2MSFTNGP11.phx.gbl...
From VB.NET, I need to write text to an RTF file, where most of it is

words
in one font like arial, but a couple of individual characters along the

way
are of a different font, e.g. a solid diamond from the ZapfDingbats font

or
a square from the GeographicSymbols font. So it needs to switch fonts

four
times along the way.

Does anyone know how this can be done in VB.NET? Thanks.


Nov 21 '05 #3

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

Similar topics

2
by: Grumfish | last post by:
In order to familiarize my self with Flash files and their bytecode I've started to make an assembler. My first problem is writing the bitfields the format uses often. It is a series of fields,...
1
by: fripper | last post by:
I have had some experience with VB .Net but I am having difficulty coming to grips with how to set up a subroutine to accept varying classes for its arguments. An example will help to explain. I...
2
by: Michael . | last post by:
I had an error before involving a temporary table, and that has been taken care of... The last message I wrote where it seemed to have needed it after I added it was because of different...
7
by: Mike Mascari | last post by:
Hello. I have time-varying relation variables similar to the ones described in this Rick Snodgrass article: http://www.informix.com.ua/articles/tempref/tempref.htm An example: CREATE...
5
by: Jeong-Gun Lee | last post by:
I'm writing a code of writing a value to a specific memory address. ================================================================= #include <stdio.h> int main() { long air; long...
12
by: dima | last post by:
Hello All! Does anybody know anything about type-safe implementation of functions with varying number of arguments? I know one old solution - elipsis (stdarg,h). But it is NOT type-safe! ...
6
by: MJ | last post by:
Is it possible to print varying numbers of labels from Access?
1
by: Dekker | last post by:
Hi I would like to transform the result of a csv-string (eg.: "name,age\nstring,int\nMac,23\nMax,24\nMike,78") into a map of vectors map<string, vector<???> >. The key of the map will be the...
89
by: Skybuck Flying | last post by:
Hello, This morning I had an idea how to write Scalable Software in general. Unfortunately with Delphi 2007 it can't be done because it does not support operating overloading for classes, or...
118
by: Chuck Cheeze | last post by:
This might be in the wrong group, but... Here is an example of my data: entry_id cat_id 1 20 2 25 3 30 4 25 5 35
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
0
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...
0
marktang
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,...
0
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 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.