开发者

Copy paste excel data into Rich text box + remove grid lines

I am trying to copy data from an excel sheet into a a rich text box in a Winform .NET project.

Right now there are grid lines are coming开发者_运维百科 up in the rich text box. How do I eliminate the grid lines from the rich text box.

Because I do not want to show the grid lines in the rich text box.

Please help me

Thanks Sandeep


you can do like this in the keydown event of you richtextbox (if you are using the normal paste method)

        private void richTextBox1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control == true && e.KeyCode == Keys.V)
            {
                e.Handled = true;
                string st = Clipboard.GetText();
                richTextBox1.Text = st;
            }
        }

hope this helps


Banged my head against wall with this one. I was testing the different methods available on the Clipboard class with nUnit and every method returned null. With nUnit, you must add the [RequiresSTA] attribute to the class.

Final result would look like [TestFixture, RequiresSTA].

Source: https://stackoverflow.com/a/5293312/1444511

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜