Solved

Change Font/Text Size in a .txt file

Posted on 2014-12-24
12
171 Views
Last Modified: 2014-12-27
I am creating a text file that will ultimately be fed into Adobe to create a file for publication.  I would like to have some control over the font as the file is being created.  I know about RTF, but an trying to keep this a little less complicated.

I'd like something like
<Get Big and Bold>Header Stuff<End Big and Bold>
Back to normal

repeat as necessary.

I've played with notepad and changing fonts, and suppose that I can reverse engineer the methods to accomplish this, but that seems like more trial and error than I am willing to undertake.


Thanks in advance, Rick
0
Comment
Question by:rickhill11
  • 6
  • 5
12 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40517139
Plain text files do not contain any font info, just text.  Text editors like Notepad will change the display font but do not put anything about it in the text file.  To format the text when you print to PDF, you need to use an editor (like Word) that will do the formatting and print from that editor.
0
 

Author Comment

by:rickhill11
ID: 40517159
Dave, I just opened a .txt file using notepad, and changed the font for the highlighted first line.  Interestingly, notepad doesn't seem to care about what is highlighted, it changed the font for the entire file.  Further, when I reopened the file, it remembered the changed font.

Will examine later with a hex dump to see if I can glean anything.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40517190
But it still did not change the text file.  All of my text and code editors allow me to change the display font.  None of them will change the actual file because that would screw up the programming.  They do remember the font that I selected but that is usually for all files and not a particular one.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 40517272
RIck,

Notepad only remembers what Font you last used and simply displays all files with those settings.  That information is not stored with the text file at all.  If you want to format your text then you'll have to use a format other than .txt.
0
 

Author Comment

by:rickhill11
ID: 40517303
Actually, Mike's comment sounds very much like Window's behavior; and I was able to reproduce exactly what he said.

So, what is the easiest way, using vc++ to introduce formatting into a file?  I've done the rtf thing, and frankly it is tedious and obnoxious.  

Thanks, Rick
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40517314
Your original question sounded like you had one file to print to PDF which is easily done with Word.  Now you're talking about VC++ which sounds like you want to write a program to convert more than one file.  Can you clarify what you want to do?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:rickhill11
ID: 40517538
Sorry, I am creating a text file with vc++ vs2012, and that file will simply be fed to Adobe or similar program and distributed in pdf format.  As I mentioned, I know that it is very possible to create a file using RTF as I have done it before.  My preference would be something a little easier.

Rick
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40517782
As I said above, a plain text file has only text and no formatting.  Why are you using VC++ / VS2012 instead of something like Word that will do formatting for you?
0
 

Author Comment

by:rickhill11
ID: 40517910
Because I am sorting and collating data from several different places, and generating a report.
0
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40517925
Then you will probably have to use RTF since plain text can't do what you want.  You might search for a C++ to PDF program.  There are a number of them but I don't know enough to recommend one to you.
0
 

Author Comment

by:rickhill11
ID: 40519881
David,

Thanks for your help.  I finally had to re-do the program to add and RTF window.

Thanks Again
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 40519889
You're welcome.  Good luck with your project.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now