本文整理汇总了C#中Altaxo.SetCommaSeparatedValues方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.SetCommaSeparatedValues方法的具体用法?C# Altaxo.SetCommaSeparatedValues怎么用?C# Altaxo.SetCommaSeparatedValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo
的用法示例。
在下文中一共展示了Altaxo.SetCommaSeparatedValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteAsciiToClipBoardIfOnlyPropertyCellsSelected
/// <summary>
/// Writes ASCII to the clipboard if only property cells are selected.
/// </summary>
/// <param name="dg">The worksheet controller</param>
/// <param name="dao">The clipboard data object</param>
protected static void WriteAsciiToClipBoardIfOnlyPropertyCellsSelected(IWorksheetController dg, Altaxo.Gui.IClipboardSetDataObject dao)
{
// columns are selected
DataTable dt = dg.DataTable;
Altaxo.Collections.AscendingIntegerCollection selCols = dg.SelectedPropertyColumns;
Altaxo.Collections.AscendingIntegerCollection selRows = dg.SelectedPropertyRows;
if (selRows.Count == 0)
{
selRows = new Altaxo.Collections.AscendingIntegerCollection();
selRows.AddRange(0, dg.DataTable.PropertyRowCount);
}
System.IO.StringWriter str = new System.IO.StringWriter();
for (int i = 0; i < selRows.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
str.Write(dt.PropertyColumns[selCols[j]][selRows[i]].ToString());
if (j < selCols.Count - 1)
str.Write(";");
else
str.WriteLine();
}
}
dao.SetCommaSeparatedValues(str.ToString());
// now also as tab separated text
System.IO.StringWriter sw = new System.IO.StringWriter();
for (int i = 0; i < selRows.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
sw.Write(dt.PropertyColumns[selCols[j]][selRows[i]].ToString());
if (j < selCols.Count - 1)
sw.Write("\t");
else
sw.WriteLine();
}
}
dao.SetData(typeof(string), sw.ToString());
}
示例2: WriteAsciiToClipBoardIfDataCellsSelected
/// <summary>
/// Writes ASCII to the clipboard if data cells are selected.
/// </summary>
/// <param name="dt">The data table.</param>
/// <param name="selCols">Selected data columns.</param>
/// <param name="selRows">Selected data rows.</param>
/// <param name="selPropCols">Selected property columns.</param>
/// <param name="dao">The clipboard data object</param>
public static void WriteAsciiToClipBoardIfDataCellsSelected(
DataTable dt,
Altaxo.Collections.AscendingIntegerCollection selCols,
Altaxo.Collections.AscendingIntegerCollection selRows,
Altaxo.Collections.AscendingIntegerCollection selPropCols,
Altaxo.Gui.IClipboardSetDataObject dao)
{
if (selCols.Count == 0)
{
selCols = new Altaxo.Collections.AscendingIntegerCollection();
selCols.AddRange(0, dt.DataColumnCount);
}
if (selRows.Count == 0)
{
selRows = new Altaxo.Collections.AscendingIntegerCollection();
int nRows = 0; // count the rows since they are maybe less than in the hole worksheet
for (int i = 0; i < selCols.Count; i++)
{
nRows = System.Math.Max(nRows, dt[selCols[i]].Count);
}
selRows.AddRange(0, nRows);
}
System.IO.StringWriter str = new System.IO.StringWriter();
for (int i = 0; i < selPropCols.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
str.Write(dt.PropertyColumns[selPropCols[i]][selCols[j]].ToString());
if (j < selCols.Count - 1)
str.Write(";");
else
str.WriteLine();
}
}
for (int i = 0; i < selRows.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
str.Write(dt.DataColumns[selCols[j]][selRows[i]].ToString());
if (j < selCols.Count - 1)
str.Write(";");
else
str.WriteLine();
}
}
dao.SetCommaSeparatedValues(str.ToString());
// now also as tab separated text
System.IO.StringWriter sw = new System.IO.StringWriter();
for (int i = 0; i < selPropCols.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
str.Write(dt.PropertyColumns[selPropCols[i]][selCols[j]].ToString());
if (j < selCols.Count - 1)
str.Write("\t");
else
str.WriteLine();
}
}
for (int i = 0; i < selRows.Count; i++)
{
for (int j = 0; j < selCols.Count; j++)
{
sw.Write(dt.DataColumns[selCols[j]][selRows[i]].ToString());
if (j < selCols.Count - 1)
sw.Write("\t");
else
sw.WriteLine();
}
}
dao.SetData(typeof(string), sw.ToString());
}