本文整理汇总了C#中Writer.NextLine方法的典型用法代码示例。如果您正苦于以下问题:C# Writer.NextLine方法的具体用法?C# Writer.NextLine怎么用?C# Writer.NextLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Writer
的用法示例。
在下文中一共展示了Writer.NextLine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bTabsv_Click
private void bTabsv_Click(object sender, EventArgs e) {
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "*.csv|*.csv||";
if (sfd.ShowDialog(this) == DialogResult.OK) {
using (StreamWriter os = new StreamWriter(sfd.FileName, false, Encoding.Default)) {
Writer wr = new Writer(os, (sender == bTabsv) ? "\t" : ",");
if (bIncludeHeader.Checked) {
foreach (DataGridViewColumn col in gv.Columns) {
wr.Write(col.HeaderText);
}
wr.NextLine();
}
foreach (DataGridViewRow row in gv.Rows) {
if (row.IsNewRow) continue;
foreach (DataGridViewCell cell in row.Cells) {
wr.Write(Convert.ToString(cell.Value));
}
wr.NextLine();
}
}
MessageBox.Show(this, "保存しました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
示例2: bCopy_Click
private void bCopy_Click(object sender, EventArgs e) {
StringWriter os = new StringWriter();
Writer wr = new Writer(os, (true) ? "\t" : ",");
{
foreach (DataGridViewColumn col in gv.Columns) {
wr.Write(col.HeaderText);
}
wr.NextLine();
}
foreach (DataGridViewRow row in gv.Rows) {
if (row.IsNewRow) continue;
foreach (DataGridViewCell cell in row.Cells) {
wr.Write(Convert.ToString(cell.Value));
}
wr.NextLine();
}
String s = os.ToString();
if (String.IsNullOrEmpty(s))
Clipboard.Clear();
else
Clipboard.SetText(os.ToString());
MessageBox.Show(this, "コピーしました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
示例3: bCopySel_Click
private void bCopySel_Click(object sender, EventArgs e) {
StringWriter text = new StringWriter();
Writer wr = new Writer(text, ",");
foreach (DataGridViewRow row in gv.Rows) {
if (row.IsNewRow) continue;
int cnt = 0;
foreach (DataGridViewCell cell in row.Cells) {
if (!cell.Selected) continue;
wr.Write(Convert.ToString(cell.Value));
cnt++;
}
if (cnt == 0) continue;
wr.NextLine();
}
String s = text.ToString();
if (String.IsNullOrEmpty(s))
Clipboard.Clear();
else
Clipboard.SetText(text.ToString());
MessageBox.Show(this, "選択部分をコピーしました。", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}