#1
|
|||
|
|||
Repeating part of a Content Control
Hi
I'm creating report templates, which need to have an address repeated at various points in the document. For greater flexibility I have created mapped content controls on the cover page for 'Property Name', 'Address Line 1', 'Address Line 2', 'Town', 'County' and 'Postcode', each of which are placed on a separate line in a table. I have grouped these controls together and styled them using the Subtitle style. I've done it like this as in the header I only want to show the property name, town and postcode, so have duplicated these mapped controls into the header - is this the best way to do it? I've tried the StyleRef to pull the info into the header, but as I need to insert multiple fields that are styled with Subtitle, my testing didn't work. I've also tried Ref field but it didn't seem to want to automatically update. Throughout the rest of the report the address is repeated in full. However, there are times when not every control is populated with data and I'm left with unfilled fields which my colleagues and I have to manually delete. As my colleagues aren't as confident with Word as I am, I would like to make this easier and remove the blank address fields automatically (without the use of VBA). Conversely, there are times when the address is quite long and we need extra address fields added on the fly (which again, can be repeated throughout the document). I should add that there are a number of other content controls in the document - some mapped, some not. I'm sure that there will be a much easier way to do what I want to do, I just need pointing in the right direction. I'm the only person who has access to the Developer tab and whilst some colleagues and I are using Word 2016, there is one person who is using Word 2010. I hope I've managed to explain my query and hope that someone will be able to assist. |
#2
|
||||
|
||||
What you need to do is to apply a different Style to each element you want to replicate in the header, then insert StyleRef fields for each of those Styles.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks for coming back to me macropod.
That's what I'd suspected I would have to do, to get StyleRef to work. However, as I wanted to make the template as easy as possible for those that are not confident with Word, I wanted to make it as simple as possible. Whilst StyleRef would pull the required information into the header, having to create a different style (up to 7 styles) with exactly the same settings, for each element of an address, could make it more complicated, especially if they are trying to diagnose why an element isn't repeating in the report. Can you think of another way that I can lay out an address on the cover sheet and then, repeat part of it in the header and the whole address at various points within the body of the text. If the only answer is to use mapped content controls, then is there a way to delete any unused ones? |
#4
|
||||
|
||||
If you're using a template, doing the set-up for this should be a once-off exercise, so the only reason an element wouldn't appear in the header as it should would be due to its omission or its insertion into the wrong content control. Other than that, the process should be seamless for your users.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
||||
|
||||
I think there are real benefits to using linked Content Controls and some drawbacks with a StyleRef.
StyleRef needs a master (the style), which has to either once only in the document or prior to the first instance of the slaves (the field). If the style gets used on something else then there will be variability in the slave field result depending on where the nearest master is located. A linked content control can be edited in any instance to change all the other instances. StyleRef requires fields to be updated after changing the master. CCs change as the cursor leaves the CC. On the other hand, StyleRef does have the advantage of working in Doc format which is one thing that CCs can't do.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#6
|
||||
|
||||
Mapped controls will work fine for any fields that you want to duplicate. Uncompleted fields will however be a problem if there are to be no macros, and if you are going to use macros to address the missing field data, you don't need to map the fields, you can instead use entry and exit macros and write the required values to a single text control.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#7
|
||||
|
||||
Not when they're in the header or footer; they update dynamically as you change the Style's content.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#8
|
|||
|
|||
Quote:
Graham, I know that you have a much deeper understanding of mapped controls (mine is superficial and depends on your Add-In or Greg's). That said, I have mapped controls which have no content and they do not seem to cause any problems (other than being blank). That may be because the utilities fix any problems that might otherwise occur. |
#9
|
||||
|
||||
Blank CCs are never completely empty - if you clear the text they revert to showing the placeholder text which can be a pain when the user wants to print it and fill it out with a pen.
The usual workaround is to add a space
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#10
|
|||
|
|||
Thank you all for your inputs - I'm slightly star-struck by everyone who has responded, as I've read a lot of your websites at length and learnt so much from you, which I thank you for. Without you all graciously divulging your knowledge, I would still only be using 20% of Word.
It is good to know that my thought processes, in terms of the pros and cons of CC vs StyleRef were on the right track. I've gone back to the drawing board for the headers and have tested assigning custom Document Properties to the Content Controls on the cover sheet, which pull the relevant info into the header. This has worked okay so far and it has the second benefit of recording those pertinent details in the Properties. I will test how well this would work with pulling the details into the body of the document, along with testing out the Ref field (as I can use switches to change the case, where needed). Failing that, I think I will stick to using mapped CCs in the body. If I add an additional CC in (to account for long addresses), then group all address lines and set the group to 'cannot be deleted'. I could then enable individual CCs in that group to be deleted, to give the user some control. As I've changed the placeholder text to a bright colour, any extra controls that need to be deleted before printing would be pretty obvious. Quote:
Thank you all once again - you've all really helped me to get a better understanding. |
Tags |
content controls, repeated content |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Content Control content deleted when re-uploading to SharePoint | Peterson | Word | 5 | 06-27-2018 08:13 PM |
insert the 2 content controls into a Repeating Section in a table | smaccharoli | Word VBA | 2 | 02-27-2018 08:49 AM |
Alternatives to Repeating Section Content Controls | ABC987 | Word | 2 | 07-03-2015 06:22 AM |
Clicking the selected Content Control checkbox returns wrong control in vba event | DougsGraphics | Word VBA | 2 | 06-24-2015 07:31 AM |
Deleting a table from a content control -- preserving the content control | BrainSlugs83 | Word Tables | 8 | 11-14-2013 03:06 AM |