コード例 #1
0
ファイル: MDIUI.cs プロジェクト: mkubala/extraCell
        private void wklejToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExtraCellTable ect = activeDocument.extraCellTable;

            if (ect.GetCellCount(DataGridViewElementStates.Selected) > 0)
            {
                try
                {
                    int x = ect.CurrentCell.ColumnIndex;
                    int y = ect.CurrentCell.RowIndex;

                    char[] lineDelim = { '\r', '\n' },
                    colDelim = { '\t' };

                    string[] rows = ((string)Clipboard.GetDataObject().GetData(DataFormats.Text)).Split(lineDelim, StringSplitOptions.RemoveEmptyEntries);

                    for (int i = 0; i < rows.Length; i++)
                    {
                        string[] cols = rows[i].Split(colDelim);
                        for (int j = 0; j < cols.Length; j++)
                        {
                            ect.Rows[y + i].Cells[x + j].Value = cols[j];
                        }
                    }
                }
                catch (Exception) { }
            }
        }