• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Output a Text File in the wanted Fonts, Colors

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
0
nickha
Asked:
nickha
1 Solution
 
gj62Commented:
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...
0
 
nickhaAuthor Commented:
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
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now