Skip to content

Printing / formatting question

Brad

Asked Mar 8, 2006, 11:56 AM EST2 answers
Share
LinkedInX
Hello I am very new to c#.
I am trying to send the below code to a printer. I works, but I want to bold the labels (ie. Name ...) Any ideas how to format in a string?

writer.WriteLine("Name: " + rdr["uname"].ToString());
writer.WriteLine("Password: " + rdr["pass"].ToString());
writer.WriteLine("User Type: " + rdr["uType"].ToString());
writer.WriteLine("Notes: ");
writer.WriteLine("\t" + rdr["notes"].ToString());
writer.WriteLine("---------------------------");
writer.WriteLine("");

Also anyone know of a good place to fine info on printing in general in c#?

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Hello,
    I think that your problem can be solved like this(if I understood the problem) you have to add in your project a Word assembly and then you have to create a word document and then you can access all the things you can do in Word . Here is a link that will show you how to do that : http://www.c-sharpcorner.com//Code/2002/Mar/WordFromDotNet.asp  and after that you can search on MSDN and you will find an example code written by them. I saw that you put after the name a value . what is that value. i mean from where do you take it? can you read my post regarding how to use data from a textbox in a word document ?
    Regards,
    Monika
    0
  • 0
    Thank you very much. I will take a look at the article.
    In the above I am pulling information from a database and populating an oldb reader, then I am adding the vars from the reader (rdr["uType"].ToString()) to a string(writer.WriteLine).
    From there I am sending the string to a printer.
    0