C#中的字符串格式化和打印 [英] string formating and printing in C#

查看:89
本文介绍了C#中的字符串格式化和打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件,其中包含需要格式化的10-15行,然后打印文件内容



公司名称

地址第1行

地址第2行

地址第3行

------------------- ----

产品数量金额

|

|

|

|

------------------------------

总计: 2000



我需要更大字体的公司名称(字体大小20,字体名称乘以新罗马,字体样式粗体tec)小字体地址行(字体大小10字体)名字时间新罗马)

产品数量线(字体名称arial,字体大小10)



格式化后需要打印这个。

i am having a text file which contains 10-15 lines which need to get formatted and then print file conatins

Company Name
Address line1
Address line2
Address line3
-----------------------
Product Qty Rate Amount
|
|
|
|
------------------------------
Total : 2000

I need company name in bigger font(font size 20, font name times new roman, font style bold tec) address line in small font(font size 10 font name times new roman)
Product qty line in (font name arial, font size 10)

after formatting in need to print this.

推荐答案

当你昨天发布这个问题时,你被告知字符串没有任何格式,文本文件也没有,并且它已经向你解释了使用PrintDocument进行打印和wha要使用不同的字体和字体大小。



从那时起没有任何变化:如果你正在打印,请使用PrintDocument,如果你使用打印作为输出到文本文件的单词你不能这样做,如果你的意思是对一个可以做到的文件这是一个不同的问题,如果你的意思是到显示器它取决于环境和你正在使用的控件。



我昨天解释了这一切 - 所以改变了什么?
When you posted this question yesterday, you were told that strings don't have any format, and neither do text files, and it was explained to you exactly how to print using a PrintDocument and what to do to use different fonts and font sizes.

Nothing has changed since then: If you are printing, use a PrintDocument, if you are using "print" as a word for "output to a text file" you can't do it, if you mean "to a file that can do it" that is a different problem, and if you mean "to the display" it depends on the environment and controls you are using.

I explained all this yesterday - so what has changed?


这篇关于C#中的字符串格式化和打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆