Output a Text File in the wanted Fonts, Colors

Posted on 2003-03-07
Medium Priority
Last Modified: 2013-12-03
I am writing in Visual C++ 6.0/C++.
What I want to do is: under C++ source code
fopen("TextFile.xxx",..); searching through the TextFile for some "wanted strings";
fonting and coloring the "wanted strings"; insert back the fonted, colored "wanted strings" onto the TextFile and use some Windows-base editor to print out the already fonted and colorred TextFile.
Ex: input TextFile contents : Name:xxxx, Address:xxx,etc
Output TextFile: Name:, Address: which are already fonted and colorred
I did try CFont->TextOut but does not work as I want.
Please help me.Thanks
Question by:nickha
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

gj62 earned 100 total points
ID: 8092614
What application is going to read the files?

You need to pick the format of the text file in order to determine how to indicate font, size, color, etc.  One option is to use Rich Text Format, or RTF formatting.  This inserts a set of control words/symbols into the text file such that any application understanding RTF can translate the document correctly.  RTF does much more than just fonts and colors - it handles most formatting you would find in a word processor.

Unfortunately, I don't know of another format that is as ubiquitous that I would recommend you use.  Of course, whatever format you choose, it will depend upon what the application is that you want to view it in, and what formats it supports...

For example, Notepad allows the user to select which font to display the document in, but I know of no way that the document can tell/force Notepad to use a specific font or size...

Author Comment

ID: 8092766
The application to read the "TextFile.TXT" is WordPad/Edit
The Fonts and Colors I need to use are very basic which any simple Editors(WordPad/Edit...) to understand, not user-defined fonts,etc.
What I want is that when I open the "TextFile.TXT/TextFil.DOC" using WordPad, the TextFile is already under Fonts and Colors.
It is possible.
I wrote it successfully under C++ for DOS by using:
fprinf with the Escape Sequence like \033[31m, etc..
but not with Windows Application using Visual C++ 6.0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question