Link to home
Start Free TrialLog in
Avatar of rickhill11
rickhill11

asked on

Change Font/Text Size in a .txt file

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
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

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.
Avatar of rickhill11
rickhill11

ASKER

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.
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.
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.
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
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?
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
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?
Because I am sorting and collating data from several different places, and generating a report.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
David,

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

Thanks Again
You're welcome.  Good luck with your project.