table rows on clipboard are resizing

User avatar
stuck
Panoramic Lounger
Posts: 8163
Joined: 25 Jan 2010, 09:09
Location: retirement

table rows on clipboard are resizing

Post by stuck »

I have a table that is longer than an A4 page. The table properties sets the table width at 100% I have some code that tidies this up as follows, it:
1) copies the first four rows of the table, they are the column headers
2) splits the table near the foot of the page
3) inserts a continuation caption
4) pastes in the header rows

I'm finding that although the header rows were copied from a table set to width 100% when they are pasted back they coming in at over 100% (at 103.9% to be precise). That means the column headers do not line up with the table and that is ugly.

I can 't figure out why the copied rows are changing size during the copy and paste. Any suggestions?

Ken
PS using the 'repeat as header rows' feature is not an option. My continuation tables must be preceded by a proper caption, hence thi scopy, split, caption and paste routine

User avatar
HansV
Administrator
Posts: 78415
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: table rows on clipboard are resizing

Post by HansV »

Do the rows also resize if you copy/paste them manually, or just when you run the macro?
Best wishes,
Hans

User avatar
stuck
Panoramic Lounger
Posts: 8163
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: table rows on clipboard are resizing

Post by stuck »

HansV wrote:
28 Sep 2020, 16:50
Do the rows also resize if you copy/paste them manually, or just when you run the macro?
Umm, yes and no, I dunno! (allegedly) identical code in another module doesn't appear to misbehave like it does in this context.

I'm half hoping just starting this thread is enough for the problem to go away. Meanwhile Google did turn up this page, which suggests it might be a long-standing known issue:
https://cybertext.wordpress.com/2010/10 ... mn-widths/

Or then again maybe it's to do with the way the rows are being selected:
https://word.tips.net/T003897_Differing ... sting.html

I will poke at it again tomorrow. Meanwhile, thanks.

Ken

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: table rows on clipboard are resizing

Post by Charles Kenyon »

You should still be able to use header rows rather than going through all of this.
http://www.addbalance.com/usersguide/tables.htm#Header
My continuation tables must be preceded by a proper caption, hence this copy, split, caption and paste routine
Please explain what you mean by a "proper caption." Chances are good you can do it without breaking up your table.
That is going to be a real mess to edit.

User avatar
stuck
Panoramic Lounger
Posts: 8163
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: table rows on clipboard are resizing

Post by stuck »

1) As predicted yesterday, the code is behaving correctly today, the header rows are pasting at the same (100%) width as the main body of the table. Conclusion, Ken's dire coding is at fault.

A) Attached is an example of the finished table (in .rtf format) that illustrates our 'house style for tables and their continuations. I hope it makes it a bit clearer what I meant by the continuation tables being preceded by a proper caption. As for them being a real mess to edit. Not at all. The tables start life in Excel and end up in Word at the click of a button, formatted / styled as required. The tables are part of a (scientific) report, which after conversion to PDF is an end product. We do not recycle these reports, new data generates a new report.

Ken
You do not have the required permissions to view the files attached to this post.

User avatar
stuck
Panoramic Lounger
Posts: 8163
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: table rows on clipboard are resizing

Post by stuck »

As expected, the problem reappeared. I have worked around it by adding a few extra lines, immediately after the paste that inserts the header rows, which resize the width of the pasted rows to 100%. It's not pretty but it works :crossfingers:

Ken

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: table rows on clipboard are resizing

Post by Charles Kenyon »

The method for handling this requires putting (continued) at the end.
Do you use those captions in a Table of Figures or anything like that?

The way to handle it is to put (Continued) at the end of your table heading and then occlude that word with a blank textbox or frame that is not anchored to or part of the heading row. I do not work with .rtf and so do not know whether table heading rows work in .rtf, nor textboxes.

User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: table rows on clipboard are resizing

Post by Charles Kenyon »

Here is a temporary link to your sample document modified. The first two pages have a single table.
https://www.dropbox.com/s/iu0of5tvpohxy ... g.rtf?dl=0

The caption is inside the table and included as one of the header rows. On page 1 you do not see the word "continued" and on page 2 you do.
The occluding textbox would normally not have any borders but they were left on to make it easy to see where it is.
It is floating in front of text and anchored outside the table.

Play with the concept.

User avatar
stuck
Panoramic Lounger
Posts: 8163
Joined: 25 Jan 2010, 09:09
Location: retirement

Re: table rows on clipboard are resizing

Post by stuck »

Charles Kenyon wrote:
01 Oct 2020, 03:29
...Play with the concept.
Thank you, I will look at it further but my first impression is that I prefer my solution. The inclusion of '(continued)' within the Caption will be a problem because the Caption appears in a TOC/TOF. It makes no sense / would be wrong for '(continued)' to appear in the TOC/TOF. Also, the length of the caption varies considerably, i.e. there is no guarantee '(continued)' could always be located directly underneath the opening 'Table N'.

NB my use of .rtf rather than .docx for my example was to ensure that this publicly shared file contained as little meta data possible

Ken