DataGridView から取得した情報を印刷する必要があるアプリケーションを作成しています。印刷したい文字列は既にありますが、方法がわかりません。PrintDocument オブジェクトと PrintDialog を使用する必要があると述べたものを Web で見つけました。
3 つの文字列があり、それぞれを 1 行 (1 行目、2 行目、3 行目) に出力したいとしますが、最初の文字列は太字で、Arial フォントを使用する必要があります。出力(紙上)は次のようになります。
string 1 (in bold and using the Arial font)
string 2
string 3
編集:(abelenkyからの質問)
コード:
private void PrintCoupon()
{
string text = "Coupon\n";
foreach (DataGridViewRow dgvRow in dataGridViewCarrinho.Rows)
{
foreach (DataGridViewCell dgvCell in dgvRow.Cells)
{
text += dgvCell.Value.ToString() + " ";
}
text += "\n";
}
MessageBox.Show(text);
// I should print the coupon here
}
では、C# を使用してそれを行うにはどうすればよいでしょうか。
ありがとう。