Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting text file parameters with Visual Fox Pro 5.0/Windows 7.0

Status
Not open for further replies.

njsandor

Technical User
Feb 21, 2010
11
US
I just transferred my VFP program to Windows 7.0 and it is running fine. I suspect this question involves the operating system rather than VFP. When I create text files for transmission, it creates text file with Notepad. The default margins and font size are different on the new operating system. As this file is used as a template for transmission, I want to know: how do I confirm if notepad is indeed being used, how do I adjust default margins and font size in this program?
 
Notepad is displaying text files with one font configured in notepad, the file is a pure text file anyway, it has no font or other formatting info in it.

Bye, Olaf.
 
it creates text file with Notepad

Perhaps this is where the confusion comes from.

NO the file is not Created with Notepad.
It is created with your FP/VFP application and it is a 'generic' text file written to your previous specifications.

Within Windows there is a File Association which 'tells' Windows what application to use when opening files that have a specific file Extension (example: .TXT)

Your current OS has Notepad associated with TXT files so that is what opens when you double click on the file. BUT that does not mean that the file was Created with Notepad.

File associations are changed at the OS level.

Good Luck,
JRB-Bldr


 
Text files have NO formatting at all: no fonts, no margins, etc.

Decisions about display are made by the software doing the display.

You asked: how do I confirm if notepad is indeed being used

You could look up the default handler for TXT files in the system registry.

You asked: how do I adjust default margins and font size in this program?

I haven't looked in quite a while. It's only in relative recently versions of Windows that Notepad would even remember previously used settings, which tells me there's probably a registry key. You could try asking around on some Windows forums.

BUT YOU SHOULDN'T DO IT. The whole point of TXT files is they carry no formatting at all and let anyone display the contents in any way they see fit. If you want to control formatting for display, TXT is the last choice I'd take. I'd use PDF instead.
 
Thanks for the information. How do I alter VFP text file parameters for font size and margin?
Earl
 
Have you read any of the above posts? VFP does not have "text file parameters". In fact, the term "text file parameters" doesn't really mean anything.

It might help if you can tell us what you are trying to achieve. What the end product is. I'm sure there is a simple solution to your problem, and we'd be glad to help you find it, but so far it's been very difficult to understand what you are asking.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I apologize for my ignorance. Let's see if I can be more clear. I was using VFP 5.0 on an older Windows OS. I created text files to transmit to a third party. I just transferred my VFP program to Windows 7.0 and the data on the text file is not fitting onto the text file. The font is bigger and the lines on right margin are being lopped off, making file unusable as information is incomplete. The text file setup was used as a template by the third party and is now unrecognizable to them. No changes were made to VFP program, only transferring to new OS.
I hope this helps and I greatly appreciate your input.
Thanks
Earl
 
OK, Earl, we might be getting somewhere. You say you created the text files. It would be really helpful if you could tell us exactly how you created them. I assume you did it in your program (is that correct)? If so, how exactly did you do it?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
My VFP database has an option to create files. This file is based on selecting span of dates, with data in that timespan included in file. I don't know if this file selection is within the VFP program, however, that is how I engage it.
Earl
 
My VFP database has an option to create files.

As Mike has alluded to above, your VFP Database does not have that Option.

Perhaps your Application has an Option like that.

And, if so, who created the Application?
Do you have the source code that you can share with us?

Finally when you say: The font is bigger and the lines on right margin are being lopped off

As has been mentioned multiple times, FONTs are NOT Written as part of the Text File.

You most likely have Fonts being used as a Default in the application (Notepad, Word, etc.) that Views the Text File when you open it - but they are not themselves part of the file data.

And, have you opened the file into something like Notepad, ensured that Word Wrap (Top Menu - Format - Word Wrap) is Not Checked and then used the Right Arrow to move your cursor to the FAR RIGHT of any specific line to ensure that it is actually being 'lopped off' instead of merely being visibly off-screen to the right?

Good Luck,
JRB-Bldr
 
it has no font or other formatting info in it.

Silly me....I always used the Font option in notepad pad to change the font and font size. I wish you guys would have told me this years ago. (format->font)



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
I always used the Font option in notepad pad to change the font and font size

Yes, within NOTEPAD, you can Display the Text data using the application's Format/Font configuration, but the Text File contents/data does not itself contain this info.

So how a Text file might appear in Notepad, might very well be different than how it might appear in Word, Notepad++, or some other text file editor - depending on how that specific application is configured.

Now that does not apply to other document types such as DOC files where the formatting is included within the file.

njsandor - Good Luck,
JRB-Bldr



 
Even after your detailed explanation the nature of txt files is every single byte in it is the text, there is no formatting, no font, no margin encoded in the file.

Therefore what you see in notepad only depends on notepad configuration. Dan guessed this configuration is stored in some registry key. That might be the case. All I can say is, if you go into the format->font option of notepad and choose another font, that will be used for display. And not only for that file. The file isn't altered at all, it's merely a display configuration of notepad and has nothing to do with the file itself or its generation.

So, if you can go back to an older system, just look what is configured for the display font there, and set your notepad the same way.
Maybe you need to choose any monospaced font, like Courier instead of the Win7 default of Lucida Console. I think in XP this was Courier New.

As you talk of margins: In the notepad window you will have no margin, unless your application writes out spaces, and then surely a monospaced font would help, but even in a normal proportional font the same number of spaces at the left side cause the same margin width throughout all lines. Notepad doesn't display any margin area at all, if there is no margin added by empty lines and spaces, the only margin options you have in notepad are about printing with margins, and you also set that up. Those settings are not preserved per file, they apply to any file you open in notepad, also generated by other applications.

Bye, Olaf.
 
>every single byte in it is the text

There is one exception, notepad accepts and writes a few bytes as so called BOM (byte order mark), which denote, which type of codepage the text is encoded in, ANSI, UTF-8 or UNICODE, which not only have differing byte orders but each char can have varying byte length.

That has nothing to do with font or fontsize, or margins. If that would be wrong you would see some or all characters as garbled unreadable wrong characters, but that's not what you describe at all.

Typically there is no BOM at all and ten notepad assumes the default ANSI text, one byte is one letter thn, encoded in the Windows System ANSI codepage, which depends on your locale version of windows, eg it's US or Western European, which don't differ much. You can also set this with the font dialog, you can set the "script", which then might make the codepage include the greek alphabet, for example. Again this would only influence the display of some characters, not their size or the text margin.

Bye, Olaf.
 
As you talk of margins: In the notepad window you will have no margin, unless your application writes out spaces

Not quite. In Notepad (in the U.S.), the default setup is for a letter sized page (8.5" x 11") with 1" margins at top, bottom, left and right. The default font setting is (IIRC) fixed-spacing at 10 c.p.i. You can adjust any/all of this, and as mentioned previously you can turn off word wrap which effectively kills the margins until printing. (Notepad is a singularly odd beastie when it comes to text editors.)

But in any case, as you say elsewhere, the point is that these settings ARE NOT part of the text file. They are Notepad settings.
 
dan,

that print margin already shows in the notepad window in the US version? Not only when printing?

Bye, Olaf.
 
Is there such a thing as a US version of Notepad? Surely, Notepad is part of Windows. As such it will have the same language as Windows itself, but the software is the same for everyone and there are no locale settings that are relevant. In any case, what we are talking about here is the default paper size, which is surely a user setting?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Could the problem be with the report I am generating, which is then displayed in Notepad/ If so, how do I change settings for report?
Thanks
Earl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top