简体   繁体   中英

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

I am trying to copy data from an excel sheet into aa 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM