Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-08-2020, 05:12 PM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default Import a section from one file into another


I have a 3-page section containing an elaborately designed table which I need to import from one file into another. When I copy-paste it, the table doesn't maintain the same settings or dimensions and spills over to the next page. There is an "insert object => text from file" option, but that inserts the entire contents of the file. My file has 35 sections in it, and I only want to import/insert one of them. Is there a way to do this?
Reply With Quote
  #2  
Old 10-08-2020, 05:43 PM
Guessed's Avatar
Guessed Guessed is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,935
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

Copying and Pasting between documents often causes layout issues. The tricks to avoiding these are:
1. Make sure both documents have EXACTLY the same style definitions. Do this by basing documents on the same template and refresh styles from that template.
2. Ensure all the same page setup/header/footers are in both documents. You can include a trailing section break in the copied content if you want to import those same settings and header/footer content when you paste.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 10-08-2020, 06:37 PM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You can include a trailing section break in the copied content if you want to import those same settings and header/footer content when you paste.
My two documents have the same style settings. I copied the section from my old file and included a trailing section break as you mentioned to do, so as to import all the same settings. Even then the table is bleeding over on the the next page, which it does not do in my original file.
Reply With Quote
  #4  
Old 10-08-2020, 06:45 PM
Guessed's Avatar
Guessed Guessed is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,935
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

I would need to look at both your docs to find where the difference lies. If you want to post both your source and target docs I can have a look and explain where the differences are.

There is an outside chance of something else being in play - document file formats perhaps?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 10-08-2020, 07:32 PM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default

How much of the docs would need to be posted? Both docs are more than 100 pages in size. Could it be limited to the pages in question?
Reply With Quote
  #6  
Old 10-08-2020, 08:35 PM
Guessed's Avatar
Guessed Guessed is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,935
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

Just the pages in question is fine. The Target document can be empty if you like. The source document only needs the content you want to paste.

Make sure you test the copy/paste on your machine before loading the sample docs to verify the issue is still there.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #7  
Old 10-09-2020, 12:13 AM
macropod's Avatar
macropod macropod is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,489
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

See: https://www.msofficeforums.com/word-...documents.html
The simplest approach at this stage using the code in question might be to save the pages concerned as a file of their own, then import them using the code in the linked thread.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 10-09-2020, 01:32 PM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default

Here I have attached two files:
(1) the target file
(2) the source file, called "Roman Samskrta Table"

If you open the target file you'll see that I've tried twice to insert the sourse file into it, but the table runs over onto the next page each time. If you look in the source file you can see what it is supposed to look like.

Although it is not in English, but by looking at the source file one can see which rows are supposed to be on the first page. Only the English letters are supposed to be at the top of the second page; the rest of the table is there on the first page.
Attached Files
File Type: docx Target File for Roman Samskrta table.docx (163.1 KB, 2 views)
File Type: docx Roman Samskrta Table.docx (113.6 KB, 2 views)
Reply With Quote
  #9  
Old 10-11-2020, 07:18 AM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default

@ Guessed: If you could kindly have a look at the files I've uploaded here and let me know where the problem is, I would be very grateful.

@Macropod: Many thanks for the macro. At this point, as it is only one table I need to bring in, I may just try to clear up whatever styles/settings discrepancies there are (with Guessed's help) and do it by hand. The links for explaining how to use macros are so lengthy, it is quite daunting especially when I just need to import one table. In the future some time I shall definitely try to learn how to use Macros.
Reply With Quote
  #10  
Old 10-11-2020, 02:27 PM
Guessed's Avatar
Guessed Guessed is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,935
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

The obvious difference I can see is the footnote numbers. In the Source file they are Arabic numerals and don't take much vertical space - in the Target file they are a different language (Hindi?) and take a lot more vertical space. This reduces the vertical space available for the 'page' contents in the Target file. There is a style associated with this number (Footnote Reference) which differs in its definition between the two documents.

I'm not seeing much difference in pagination apart from that. If you resolve that difference between the two files are you still seeing a pagination difference when pasting?
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #11  
Old 10-13-2020, 11:49 AM
Swarup Swarup is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2019
Competent Performer
Import a section from one file into another
 
Join Date: Jul 2018
Posts: 146
Swarup is on a distinguished road
Default

By 'footnote number' you refer to the call number, right? That is, above the table there is a paragraph of text, at the end of which there is a footnote number. To see whether that number is the problem, I reduced that number all the way down to a font size of '1' i.e. made it so small it is almost invisible. But it did not make any difference. The table still bleeds over onto the next page by two lines as it was before I changed the font size of the footnote. So I think the problem must be due to something else.
Reply With Quote
  #12  
Old 10-13-2020, 04:53 PM
Guessed's Avatar
Guessed Guessed is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,935
Guessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to allGuessed is a name known to all
Default

The styles in the two documents are NOT the same. Normal for instance is Arial in one doc and Nirmala in the other. You then have local formatting applied over the top of paragraph styles so that under the first heading you have three different fonts applied to the first three paragraphs.

You are wasting your time trying to achieve consistency when copy / pasting if your documents are full of inconsistencies in the first place. Remove all the local formatting and get your style definitions right if you want to get any control of this.

The fastest way to achieve consistency is to remove the local formatting. Do this by selecting all and resetting font and paragraph formatting. This is done by three consecutive keystrokes - Ctrl-A then Ctrl-Q and Ctrl-Space. There is a drawback on this method in that it will also remove some Character Styles that you probably want to keep applied but it is worth it to get back to a consistent state.

If that changes the look of your content (and it will), then you modify the style definitions to restore the formatting that you want. The aim is that the content is formatted ONLY by application of styles and NOT by local formatting like you currently have. Once your basic document formats are the way you want them, you can re-apply the Character styles to the footnote anchors and references.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #13  
Old 10-13-2020, 10:15 PM
macropod's Avatar
macropod macropod is offline Import a section from one file into another Windows 10 Import a section from one file into another Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 20,489
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

Quote:
Originally Posted by Guessed View Post
The styles in the two documents are NOT the same. Normal for instance is Arial in one doc and Nirmala in the other. You then have local formatting applied over the top of paragraph styles so that under the first heading you have three different fonts applied to the first three paragraphs.

You are wasting your time trying to achieve consistency when copy / pasting if your documents are full of inconsistencies in the first place.
Content replication via VBA's FormattedText method - which is what the macro in the link I posted uses - is generally sufficient to cope with such anomalies.

For manual copying/pasting, setting Word's copy/paste options to keep the source formatting for both pasting between documents and for Style conflicts should achieve the same outcome.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Import Data From One File To Another honkin Excel 1 07-27-2019 01:44 AM
How to import a section into Onenote app Ashanti Fraser OneNote 0 01-19-2017 05:40 PM
Import a section from one file into another Import a specific range (bookmarked section) from all Word docs in a selected folder Greengecko Word VBA 5 06-14-2016 07:54 AM
Import a section from one file into another Execute VBA on File Import npalmer610 Word VBA 1 04-12-2016 06:01 PM
Import a section from one file into another OST file import duanne14 Outlook 3 03-13-2011 07:48 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 01:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft