• Pasting rows between tables (Word 2000)

    Author
    Topic
    #426518

    I most always have trouble pasting rows from one table into another table. I’m careful to make sure both tables have the same number of columns, but when I paste in the new rows, they don’t conform to the width of the columns in the receiving table. Is there an easy way to get this to work?

    Viewing 1 reply thread
    Author
    Replies
    • #985914

      (Edited by jscher2000 on 18-Nov-05 23:39. )

      Starting in Word 2000, I believe the default is to let the content stretch the size of cells. Unless you turn this off and rigorously set all the column widths, it would be a miracle to find two tables with the same layout. One way to try to get them the same is to save a blank table of the correct layout as an AutoText entry, and use that to create all your tables for that particular situation.

      Added: Actually, if you are copying, say, three rows from the source table, and you select three rows in the destination table, Word may paste the contents (and font/paragraph formatting) without disturbing the layout. I don’t keep careful tabs on exactly when Word does which behavior, but you could experiment with this.

      • #986025

        I tried several ways of pasting the rows but the only thing that seems to work is this:

        1. Create blank rows in the receiving table
        2. Select the rows in the table you’re copying from, put them on clipboard
        3. Do a Paste Special, Unformatted into the blank rows in the receiving document

        The two problems with this are (1) any attributes in the pasted rows are lost, and (2) any formatting in the columns of the receiving table (e.g., centering) is lost. Also, it’s inconvenient to have to create blank rows in the receiving table first, especially when you have a large number of rows to copy (152 in this case).

        I find it hard to believe that Word doesn’t have some easy way of doing this kind of thing without jumping through these hoops and losing formatting like this. This is a common operation and an important feature for a word processing program to have. The paralegals in my law firm do nothing but this kind of work (putting mammoth tables together from different sources). WordPerfect does this seamlessly and I would be shocked if Word doesn’t have a way to do it as well.

        Can anyone help clear this up?

        (Thanks for your reply, Jefferson.)

        • #986038

          Rummaging in my code archive, I came upon the following macro. It assumes that
          a) all tables in the document have the same number of columns.
          all cells in a column in one table have the same width.
          It will make the column widths of all tables in the document the same as those in the first table in the document.
          Perhaps you can use it. You could copy the source and destination table to a temporary document if you don’t want all tables to have the same column widths in the document you’re working with.

          Sub FixColWidths()
          Dim aTable As Table
          Dim ColWidths() As Single
          Dim ColSpace As Single
          Dim i As Integer, n As Integer, j As Integer
          Application.ScreenUpdating = False
          Set aTable = ActiveDocument.Tables(1)
          n = aTable.Columns.Count
          ReDim ColWidths(1 To n)
          For i = 1 To n
          ColWidths(i) = aTable.Columns(i).Width
          Next i
          ColSpace = aTable.Rows.SpaceBetweenColumns
          For j = 2 To ActiveDocument.Tables.Count
          Set aTable = ActiveDocument.Tables(j)
          For i = 1 To n
          aTable.Columns(i).Width = ColWidths(i)
          Next i
          aTable.Rows.SpaceBetweenColumns = ColSpace
          Next j
          Set aTable = Nothing
          Application.ScreenUpdating = True
          End Sub

          • #986044

            Thank you, Hans. I still can’t believe there’s not an easier solution to this.

            Russ

    • #986117

      There are different ways to paste content in. I don’t normally have the same problem as you and I often paste cells into existing tables specifically to realign the cell widths to the target table. I haven’t got Word 2000 on the current computer but I certainly had less table issues with that version than I do with the later versions.

      In the later versions of Word eg 2002/2003 I have noticed that you don’t want to copy the final cell of a table as it contains hidden information that may cause the inserted cells to be a separate embedded table and not merge into the one table. I avoid this by adding a new row at the bottom of the copied table and not including that row in the copy.

      Once I have my copied cells in the clipboard then I go to the target table and put my (collapsed) selection cursor in the cell where I want my paste to start. A simple paste then works nicely for me. Note that selecting cells before doing the paste can yield different results.

      Is there local formatting in your tables? Are the tables set to resize automatically to the content? Perhaps these factors are clouding your experience.

      • #986137

        Andrew, the funny thing is, I don’t always have a problem pasting rows from one table to another–just sometimes. I haven’t been able to tell what the problem is when it doesn’t work.

        What do you mean “collapsed” selection cursor? When you say “simple paste,” do you mean just a regular paste or Paste Special?

        The column widths are all set to resize automatically to the content. By “local formatting” I assume you mean additional paragraph formatting not found in the styles. Nope, none of that.

        As I mentioned in my reply to Jefferson, the only thing that worked in this case was to first select the proper number of rows in the target table and then do a Paste Special, Unformatted. I’m not at work right now and so don’t have the document handy, but as I recall, when I did a Paste Special, Unformatted without first selecting rows in the target table, the entire paste was put into the cell where my cursor was.

        Also, when I did a regular paste with rows selected in the target table, the columns of the insertion did not conform to the column widths in the target table.

        Thanks for the tip about not copying the final cell of a table in later versions of Word.

        • #986139

          Russ,

          I normally get away with a regular paste but have had rare occasions when the column widths don’t match. I have never felt the need to fully work out the issues though as the fix is usually quick enough because I have table formatting macros in my templates. Can you post a sample doc with a couple of tables that doesn’t work for you so we can test it ourselves and see if there is something peculiar with those tables.

          When posting table cells I would only very rarely use Paste Special and then only if I don’t want a table structure in the paste.

          Is copying between files an issue or is this within a single file?

          • #986257

            Andrew,

            I’m not at work today, so I’ll try to post a document with samples of both tables tomorrow. The two tables are in separate documents. The general problem I’m facing in all of this is that at my law firm, the tables are created by different people (sometimes paralegals, sometimes secretaries, sometimes attorneys), so I as a word processor have to deal with all kinds of formatting, good and bad.

            Thanks for offering to take a look.

            Russ

          • #986501

            I’m using Word 2002 and just did the following:

            1. I hit the “New” button to give myself a new blank document.
            2. I used the Insert Table button to insert a 3×3 table.
            3. I went to the end of the table (outside it), moved down a couple paragraphs, and again used the Insert Table button to insert a 2nd 3×3 table.
            4. I clicked/dragged the boundary between the 1st & 2nd columns of the 1st table to create unequal column widths.
            5. I double-clicked at the left table boundary to select the 2nd row of the 1st table, and then copied it to the clipboard.
            6. I clicked into the first cell of the 2nd row of the 2nd table (collapsed IP).
            7. I did a normal paste.

            Result: The 2nd row (of 4 rows) in the 2nd table has different column widths than the other 3 rows.

            (One more reason to miss WordPerfect, say I.)

            • #986699

              I can see what you have done that is different to the way I do it. Your step 5 selection includes the end of row marker to the right of the table – I presume this is where the rows cell width information is stored.

              Try modifying step 5 to select the CELLS by dragging across the three cells and not including the end of row marker. Now when you copy this into the table above you will get the same column widths because you will be copying into existing cells (not inserting new rows). This means in practice that you may need to insert a new blank row to avoid overwriting existing content. The quickest way to do this is to put your cursor at the end of cell marker location and press Enter.

              New rows get added automatically at the bottom of the table if there are not enough rows to cater for your clipboard contents.

              I know this is not going to change your opinion of Word vs WP but I think this shows good flexibility in the software depending on what was in your clipboard and I still think that Microsoft got it right.

            • #986767

              Thanks for the tip. That works reasonably well — although, as you noted, it overwrites the existing row in the target table, so you first have to add a new empty row to the target table (in the desired location) that you can paste over.

            • #986792

              Andrew and st3333ve,

              Sorry for not getting back until now. Because of the Thanksgiving holiday week, some of our staff is on vacation and I haven’t had a moment to reply.

              In the meantime, Andrew, I tried your suggestion of not including the end-of-row marker when selecting the rows to be copied. It worked!! Of course I did have to create enough blank rows in the receiving table to accommodate the rows I was copying, but the columns in the copied rows conformed to those in the receiving table. Thanks for that great solution.

              It makes sense that the row formatting would be stored in the end-of-row marker given Word’s convention of putting the formatting at the end of a structure (paragraph mark for a paragraph, trailing section break for a section, etc.). I’ve also heard of solving some document-corruption problems by selecting the entire document except for the final paragraph mark and pasting to a new document. I’ve never tried that myself, however.

              Although it seems kind of moot, I’ve attached a document with the two tables as you suggested, Andrew. Let me know if you find anything odd in the formats.

              Both of you guys have used the term “collapsed” when talking about the cursor or insertion point. What does that mean?

              Russ

            • #986795

              “Collapsed” just means nothing is selected — i.e. that the “Selection” is an IP (insertion point).

              The reference in my previous post to a “collapsed IP” arguably belongs in the Dept. of Redundancy Dept.

            • #986798

              I would disagree that it was redundant to mention the collapsed selection – I would have questioned you if you hadn’t mentioned it. Your clear description of your steps is what allowed me to guess where the problem lay and if you hadn’t mentioned those little details we would still be none the wiser.

              I wouldn’t try to paste multiple cells into an expanded selection of cells because I wouldn’t know what to expect from the result. This may just be a carry over from Excel where I would be nagged about selection shape not matching clipboard shape if I don’t select the matrix of cells correctly.

            • #986803

              I’d agree that “collapsed selection” isn’t redundant, but “collapsed IP” arguably is, since IP generally refers to a collapsed selection all by itself, as in:

                  If Selection.Type = wdSelectionIP Then ... 

              Now if you don’t mind, I’m going to get back to pondering how Word allows me to select several consecutive rows without the end-of-row markers “in between” the selected rows being included in the selection. (Selecting consecutive paragraphs without the “in between” paragraph marks takes a lot more effort, no?)

              I’m not looking for an “answer” so much as working up an appetite for stuffing and pecan pie.

            • #986796

              Russ, I’ve had a look at your file and there doesn’t appear to be anything special about your formats. I guess your issue was just in the way you were selecting the cells for copying.

              Collapsed selection is just stressing that there is nothing currently selected in the file – just a flashing cursor. The opposite of this is an ‘extended selection’ where something is actually selected (eg by a click and drag).

    Viewing 1 reply thread
    Reply To: Pasting rows between tables (Word 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: