Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            var sb = new StringBuilder();

            var hd = new List <String>();

            foreach (DataColumn c in Source.Get(context).Columns)
            {
                hd.Add(c.ColumnName);
            }

            sb.AppendLine(CreateLine(hd.ToArray(), Escape.Get(context)));

            foreach (DataRow row in Source.Get(context).Rows)
            {
                var body = new List <String>();
                for (int i = 0; i < Source.Get(context).Columns.Count; i++)
                {
                    if (Source.Get(context).Columns[i].DataType == typeof(DateTime) || row[i].GetType() == typeof(DateTime))
                    {
                        body.Add(row[i] != null ? ((DateTime)row[i]).ToString(DateTimeFormat.Get(context)) : null);
                    }
                    else
                    {
                        body.Add(row[i].ToString());
                    }
                }
                sb.AppendLine(CreateLine(body.ToArray(), Escape.Get(context)));
            }

            System.Windows.Clipboard.SetText(sb.ToString());
        }