Solved

Change Font/Text Size in a .txt file

Posted on 2014-12-24
12
197 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 83

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 83

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 83

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 83

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 83

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 83

Expert Comment

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
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 synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

624 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