Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 set format (font,color,size etc) of txt file in C#

Author  Topic 

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2007-10-12 : 02:50:25
Hi,

how to format the data (font,color,size etc)while writing in a .txt file using StreamWriter in C# Windows application.Mainlly i want to
change Font Size of data to which i write in text File.


Ranjeet Kumar Singh

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-12 : 04:38:16
TEXT files do NOT have format.
RTF-files do. And other format-capable document file-types.




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

ranjeetsingh_6
Posting Yak Master

125 Posts

Posted - 2007-10-12 : 05:07:31
Thanks.

But a general notepad file has formate feature in which we can set font size,font style then why can not we implement it through .net
when we write any thingh.

Is any solution to change font Size of text file because due to some reason i do not want to use other file(.doc,.rtf etc) to Write data.

Ranjeet Kumar Singh
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-12 : 06:10:19
Yes, you can change the font in notepad EDITOR.
But when saving as TEXT, formatting is gone.

When you change FONT in NOTEPAD, the style is NOT written to the file. It is saved in the registry so that next time you start NOTEPAD, you get same style as default!




E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-12 : 06:14:42
it doesn't work like you wish it to work... as Peso said.

but if you want to see for yourself look at System.Drawing.Font class.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -