Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 213
  • Last Modified:

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
0
rickhill11
Asked:
rickhill11
  • 6
  • 5
1 Solution
 
Dave BaldwinFixer of ProblemsCommented:
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
 
rickhill11Author Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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
 
rickhill11Author Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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
 
rickhill11Author Commented:
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
 
Dave BaldwinFixer of ProblemsCommented:
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
 
rickhill11Author Commented:
Because I am sorting and collating data from several different places, and generating a report.
0
 
Dave BaldwinFixer of ProblemsCommented:
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
 
rickhill11Author Commented:
David,

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

Thanks Again
0
 
Dave BaldwinFixer of ProblemsCommented:
You're welcome.  Good luck with your project.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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