This project is read-only.
1
Vote

Copying Grid to clipboard does not work properly

description

All,
copying a grid to the clipboard does not work properly as some columns are merged while the last one remains empty. (Version 4_40).
StringArrayToString is guilty.

Here is the fix :
    protected static string StringArrayToString(string[,] values)
    {
        System.Text.StringBuilder builder = new System.Text.StringBuilder();

        int nr = values.GetLength(0);
        int nc = values.GetLength(1);
        for (int r = 0; r < nr; ++r)
        {
            for (int c = 0; c < nc; ++c)
            {
                builder.Append(values[r, c]);
                if (c != nc - 1) // <==== replace nr by nc and that will fix the issue                       
                    builder.Append('\t');
            }

            if (r != nr - 1)
                builder.Append("\x0D\x0A");
        }

comments