writing data on files using c#.net

Hello all,

 I am creating a rich text document file and writing some data.using c#.net

This is fine but i want to present data using style(eg. bold,font-size,etc).

How is this possible?

the code used is

System.IO.

Directory.CreateDirectory("C:/Receipt");

TextWriter tw = new StreamWriter("C:/Receipt/Receipt-" + ShipId + "-" + OrderNumber + ".rtf");

tw.WriteLine("This is the text to be bold but couldn't be bold");

tw.WriteLine("\r\n"

Any help would be appreciable

0
Bibek
12/24/2006 11:46:26 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

3 Replies
398 Views

Similar Articles

[PageSpeed] 38

hi,

you can try something like that

 FileStream sw =
File.Open(Server.MapPath("Sample1.doc"),FileMode.Truncate);
StreamWriter MyFile = new StreamWriter(sw);
MyFile.WriteLine("{\\rtf1 ");
string sRTF = string.Empty;
sRTF = @"{\par This is some {\b bold} text.\par}";
MyFile.WriteLine(sRTF);
MyFile.WriteLine("}");
MyFile.Close();
sw.Close();
Response.Write("<META HTTP-EQUIV='REFRESH'
Content=0;URL=Sample1.doc>");

0
KirilRusev
12/24/2006 3:50:48 PM

also this links might be of great help :)

http://msdn2.microsoft.com/en-us/library/aa537151(office.11).aspx

http://support.microsoft.com/default.aspx/kb/270906/

 

happy codding;) 

0
KirilRusev
12/24/2006 3:52:25 PM

Hi,

Using a RTF control might be easier. Otherwise you need to write the syntax of RTF, try this:

http://www.devdirect.com/ALL/TEXTEDIT_PCAT_1858.aspx

 

0
George
12/27/2006 1:35:43 AM
Reply:

Similar Artilces:

Sending SMS using vb.net or C#.net using vb.net or c#.net
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At http://www.WebLogicArts.com/DemoList.aspx there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of develo...

used a c#.net to vb.net converter and am now getting a syntax error.
ok I used a cool utility at http://www.kamalpatel.net/ConvertCSharp2VB.aspx to convert some c#.net to vb.net and it spit out a bunch of code which almost works but I am getting a syntax error on this line Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) I tried it that way and also like Imports (StreamReader sr = Shadows Function)() As StreamReader(objResponse.GetResponseStream()) but either way gave the same error Compiler Error Message: BC30035: Syntax error. Source Error: Line 26: Line ...

Problem when get data from Excel file using ADO.NET
THIS IS MY CODE Private Sub GetDataFromXLS() Dim strConn As String Dim objConn As OleDbConnection Dim sql As String strConn = _ "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=C:\Data.xls;" & _ "Extended Properties=Excel 8.0;HDR=Yes;" objConn = New OleDbConnection(strConn) objConn.Open() sql = "SELECT ProductCode, ProductName FROM [Data$]" '-Data is name of sheet in Data.xls. Dim objComm...

Is possible to import data from CSV file into database using c# .net
Hi,  I am using visual studio.net 2005 and mysql server (5.0 .net connector).I want to load data from a csv file and set them in database table. The CSV data are not loaded into database table, I am getting error in this line 13: cmd1.ExecuteNonQuery(); Also I have tried to create a stored procedure to load data and send the file path as parameter, but it is not impossible? Please a help..... my code: 1 string strCSVFile = "C:\\Import.csv"; 2 MySqlConnection conn1 = new MySqlConnection(connectionString); 3 4 string strLoadData = "LOAD D...

How to convert .tiff image file to .pdf file without using any 3rd party tool using C#.net
HI allI have a urgent requirement i want to convert .tiff image to .pdf file Thanks in advance Regards RaviPlease click "mark as answer" if this post helped you. I dont think its possible without doing a lot of code or using third party tools, but if you  are looking for a free tool you can try a combination of http://blog.codebeach.com/2008/02/convert-multipage-tiff-to-pdf-in-net.htmland  http://www.codeproject.com/KB/aspnet/Creating_PDF_documents_in.aspx Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answer" for this pos...

use of vb.net and c#.net
i make a small website using vb.net,  in it i make a 2 class in C#.net. that i want to use in that website, i dont know how to call that class. let your class is  - class clsMyClass    {        public void myFunction()        {            // do something        }    } now the first way - create objectclsMyClass myObj = new clsMyClass();myObj.myFunction(); // call function================...

Smart Device Application for file transfer to a remote server in .Net Compact Framework (Using Visual Studio.Net 2003,C# code)
Dear all, We are developing a smart device application (using C# code) for .Net Compact Framework where we need to write a programme in C# code to transfer a file from mobile device to remote server/machine.Can anyony help us regarding this aaplication.If you have already done this or you find any article/link regarding to this application then please let me know about that. My mail id : anirbandas.ju@gmail.com Looking forward for your reply soon. Regards Anirban   hi hav u got any solution , becoz i too need. plz share with me...

Any good example for write, read a specific node value from a xml file using C#.net
  Is there any good example for write, read a specific node value from a xml file using C#.netRegards Anu Palavila > using System.Xml; > using System.Xml.XPath; > Insertion: >         XmlDocument xmlDoc = new XmlDocument(); >         xmlDoc.Load(MapPath("~/App_Data/Users.xml")); >         XmlDocumentFragment docFrag = xmlDoc.CreateDocumentFragment(); >         string id = txt_ins_uid.Text; >         string name = txt_ins_uname.Text; >    ...

Using Dot Net Nuke to maintain a site developed in VS.NET using C#
Hi,Does anyone know if there is a way to create a site using C# and Visual Studio.NET 2003, but then use Dot Net Nuke to allow non-technical users to add content to the site.  The current state of the site must be accessible in both VS.NET and DNN regardless of which application saved it last.  Also preferably I would like the language used to remain C# even when edited by the marketing staff, so that I can still maintain it myself using VS.NET.  Hope you understand what I mean. If this is not possible, I wonder if anyone knows what solution I am after.   Thanks in adv...

How to get datasource name dynamically from .txt / .xml file using C#.net 2.0 with Mysql 5.0
I am using C#.Net 2.0 With MySql 5.0. I created a project and it works fine in my machine. But problem occurs when i try to run the project other than my machine. I wrote datasource=mysystem name in connection string. Is it possible to get datasource name dynamically from a text file (*.txt) or from .xml file for MySql.Regards,Tamizhselvi  Add an App.Config file to your project and you can drop a connection string in there like so:  <connectionStrings>    <add name="PICK A NAME" connectionString="YOUR CONNECTION STRING"/>...

How to Create .mdb file from Excel file using C#.net
Hi all I want to create .mdb file that i have created excel feel from MS jet Database... through code behind Help me in this..  Regards RaviPlease click "mark as answer" if this post helped you. How to create an mdb file programmtically:http://support.microsoft.com/kb/317881How to import Excel data into it: http://www.mikesdotnetting.com/Article.aspx?ArticleID=79 Regards Mike [MVP - ASP/ASP.NET]My site...

which is shou i use? Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NET
Microsoft .NET Framework 1.1 Data Provider for Oracle and the Oracle Data Provider for .NETI am confused?Which is better or which one should I use?BTW, I am going to use .net 2.0 with oracle 9. Can anyone tell me what shou I use for working with oracle database?Thanks very much in advance!Justin Oracle's data provider has more functionality than Microsoft's.If your doing transaction processing you can have SAVEPOINTs, which Microsoft's data provider does not provide.Also, Oracle has PL/SQL Associative Arrays which are very powerful.Oracle also allows you to bind parameters by name and pos...

.Net 2.0 Web application using Vb.net is unable to create object of another dll writen in C# .net 2.0
Hi, I habe created one ASP.net web application using Vb.net which is adding reference of dlls written in C# and .net 2.0. But whenever trying to create object of referencing dll, it is throwing error :Object reference does not set to an object. But, locally it is working fine,. In the server i have deployed the .aspx files and dll files in the bin. There were already an web.config in the server which is of .net 1.1. But checked it is retrieving value for that web.config correctly. Should i have to deply any other files and if not what can be the solution for this? Please help. Thanks, So...

Web resources about - writing data on files using c#.net - asp.net.getting-started

Pulitzer Prize for Feature Writing - Wikipedia, the free encyclopedia
1979: Jon D. Franklin , Baltimore Evening Sun , for ' Mrs. Kelly's Monster ', "an account of brain surgery ." 1981: Teresa Carpenter , Village ...

From The Career Files: How Your Legal Writing Class Prepares You For The MPT
There's a link between Legal Research and Writing (LRW) and other law school classes and the MPT on the bar exam.

Give the gift of writing with Ulysses for iPad at half price
... or get the app for yourself because it is only on sale for a limited time and you can even grab a greeting card to go with it. Robust writing ...

‘Arrested Development’ Season 5 is already in the writing stage
The 2016 TV landscape is shaping up to be something of a digital time machine. As we detailed last week , a few of the more exciting and curious ...

BlogHer Writing Lab January 2016 Prompts
The theme for January's BlogHer Writing Lab is BALANCE. Here are some prompts to get you going if you're participating in the BlogHer Writing ...

A Guide to Writing About Unfamiliar Topics
... know how to pull it off, which usually works just as well. If you want to be a freelance writer or blogger, you’ll need to get used to writing ...

Christie, Who Unsuccessfully Prosecuted Middle-East Students Cheating On An Exam, Tries Re-Writing History ...
... is just silly, as you can see from the This American Life episode on one of them below. Yesterday, Alexander Burns and Charlie Savage. writing ...

Today's Economic History: Writing Is (and Other Things Are) Not Naturally Human
**Today's Economic History:** For Homer and his audience, writing is unnatural and un-human: "many deadly signs on a folded tablet...". What ...

What are the top five most influential songs of 2015? No.2 James Bond theme tune The writing's on the ...
Krish Kandiah continues his series exploring the themes and messages behind the most influential songs of the year

Time-lapse bio ink blooms to reveal your secret writing
Remember those invisible ink pens? A new kind of ink made from algae lets you write or draw now, so someone can see your creation in stages. ...

Resources last updated: 1/1/2016 11:15:28 AM