We use cookies to provide you with a great experience. By using our site you to agree to our use of Cookies. Package com.programmingfree.simplepdfsearch; import org.apache.lucene.queryParser.ParseException; import org.pdfbox.pdmodel.PDDocument; import org.pdfbox.util.PDFTextStripper; import java.io.File; import java.io.IOException. Overview. Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find it for you! CPD has been through three major incarnations: First we wrote it using a variant of. The ability to duplicate text in an editor can be handy. vi and vim have several useful copy and paste commands. The command âYâ or âyyâ copies (yanks) one or more lines. To copy one line, two lines, 10 lines, and all. Quickview. A clipboard-based framework for copying and pasting data. Supports both simple and complex data, including text strings, complex data structures, text and binary stream data, and. Copy Paste in Datagridview Control. Here it is in vb. Private Sub dgv. Return. Series_Cell. Mouse. Click(By. Val sender As System. Object, By. Val e As System. Windows. Forms. Data. Grid. View. Cell. Mouse. Event. Args) Handles dgv. Return. Series. Cell. Mouse. Click'if the datagridview was right clicked, set the currentcell to the right- clicked cell and then show a context menu with options for filling the right- clicked cell. If (e. Button = Windows. Forms. Mouse. Buttons. Right) Then. Try'highlight the right- clicked cell, make it the dgv's current celldgv. Return. Series. Current. Row. Selected = Falsedgv. Return. Series. Rows(e. Row. Index). Selected = Truedgv. Return. Series. Current. Cell = dgv. Return. Series. Rows(e. Row. Index). Cells(e. Column. Index)dgv. Return. Series. Context. Menu. Strip = Context. Menu. Strip. 1Catch ex As Exception. Msg. Box(ex. Message)End Try. End If. End Sub'Private Sub dgv. Return. Series_Cell. Mouse. Click(sender As Object, e As Data. Grid. View. Cell. Mouse. Event. Args)' If (dgv. Return. Series. Selected. Cells. Count > 0) Then' dgv. Return. Series. Context. Menu. Strip = Context. Menu. Strip. 1' End If'End Sub. Private Sub cut. Tool. Strip. Menu. Item_Click(sender As Object, e As Event. Args) Handles Cut. Tool. Strip. Menu. Item. Click' Copy to clipboard. Copy. To. Clipboard()' Clear selected cells. For Each dgv. Cell As Data. Grid. View. Cell In dgv. Return. Series. Selected. Cellsdgv. Cell. Value = String. Empty. Next. End Sub. Private Sub copy. Tool. Strip. Menu. Item_Click(sender As Object, e As Event. Args) Handles Copy. Tool. Strip. Menu. Item. Click. Copy. To. Clipboard()End Sub. Private Sub paste. Tool. Strip. Menu. Item_Click(sender As Object, e As Event. Args) Handles Paste. Tool. Strip. Menu. Item. Click' Perform paste Operation. Paste. Clipboard. Value()End Sub. Private Sub Copy. To. Clipboard()' Copy to clipboard. Dim data. Obj As Data. Object = dgv. Return. Series. Get. Clipboard. Content()If (Not Is. Nothing(data. Obj)) Then. Clipboard. Set. Data. Object(data. Obj)End If. End Sub. Private Sub Paste. Clipboard. Value()' Show Error if no cell is selected. If (dgv. Return. Series. Selected. Cells. Count = 0) Then. Message. Box. Show("Please select a cell", "Paste", Message. Box. Buttons. OK, Message. Box. Icon. Warning)Return. End If' Get the starting Cell. Dim start. Cell As Data. Grid. View. Cell = Get. Start. Cell(dgv. Return. Series)' Get the clipboard value in a dictionary. Dim cb. Value As New Dictionary(Of Integer, Dictionary(Of Integer, String))cb. Value = Clip. Board. Values(Clipboard. Get. Text())Dim i. Row. Index As Integer = start. Cell. Row. Index. For Each row. Key As Integer In cb. Value. Keys. Dim i. Col. Index As Integer = start. Cell. Column. Index. For Each cell. Key As Integer In cb. Value(row. Key). Keys' Check if the index is within the limit. If (i. Col. Index < = dgv. Return. Series. Columns. Count - 1 And _i. Row. Index < = dgv. Return. Series. Rows. Count - 1) Then. Dim cell As Data. Grid. View. Cell = dgv. Return. Series(i. Col. Index, i. Row. Index)cell. Value = cb. Value(row. Key)(cell. Key)End Ifi. Col. Index += 1. Nexti. Row. Index += 1. Next. End Sub. Private Function Get. Start. Cell(dg. View As Data. Grid. View) As Data. Grid. View. Cell' get the smallest row,column index. If (dg. View. Selected. Cells. Count = 0) Then. Return Nothing. End If. Dim row. Index As Integer = dg. View. Rows. Count - 1. Dim col. Index As Integer = dg. View. Columns. Count - 1. For Each dgv. Cell As Data. Grid. View. Cell In dg. View. Selected. Cells. If (dgv. Cell. Row. Index < row. Index) Thenrow. Index = dgv. Cell. Row. Index. End If. If (dgv. Cell. Column. Index < col. Index) Thencol. Index = dgv. Cell. Column. Index. End If. Next. Return dg. View(col. Index, row. Index)End Function. Private Function Clip. Board. Values(clipboard. Value As String) As Dictionary(Of Integer, Dictionary(Of Integer, String))Dim copy. Values As Dictionary(Of Integer, Dictionary(Of Integer, String)) = _New Dictionary(Of Integer, Dictionary(Of Integer, String))()Dim lines As String() = clipboard. Value. Split(vb. Cr. Lf)For i As Integer = 0 To lines. Length - 1copy. Values(i) = New Dictionary(Of Integer, String)()Dim line. Content As String() = lines(i). Split("\t")' if an empty cell value copied, then set the dictionary with an empty string' else Set value to dictionary. If (line. Content. Length = 0) Thencopy. Values(i)(0) = String. Empty. Else. For j As Integer = 0 To line. Content. Length - 1copy. Values(i)(j) = line. Content(j)Next. End If. Next. Return copy. Values. End Function.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |