Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change Font/Text Size in a .txt file

Posted on 2014-12-24
12
Medium Priority
?
201 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
[X]
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
  • 6
  • 5
12 Comments
 
LVL 84

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 84

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
Independent Software Vendors: 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!

 
LVL 86

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 84

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
 

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 84

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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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 84

Expert Comment

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

Featured Post

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!

Question has a verified solution.

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

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…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

715 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