Copying a style from one Word document to another

This content is 2 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

My work involves a lot of writing. And document editing. Mostly in Microsoft Word. I’m a heavy user of our corporate template and, over the years, I’ve worked with colleagues to iron out issues in the built in styles.

If you’re not familiar with styles, they are a method to apply standardised formatting to a block of text. Instead of selecting the font, size, colour, indentation, bold, italic, etc. just select a style. The style groups together all of the associated formatting so you can pick Normal text, Heading 1, Heading 2, Bullets 1, Bullets 2, Subtitle, Quote, Emphasis, etc.

if you’ve ever created a website using HTML and CSS, you’ll be familiar with separating the content from the presentation. This is a similar concept.

There’s more information about customising and creating styles in this Microsoft support article.

I sometimes find that the styles in a Word document get corrupted when I’m working collaboratively. Common things I’ve learned to spot are that indentation is wrong on bulleted text, or that headings lose their numbering. I haven’t found the cause but I suspect it’s text copied from incorrectly-formatted documents with similar style names. I did find a fix though!

Faced with a stubborn Heading style that had lost its numbering a few weeks ago, I stumbled on a Microsoft Answers post that told me how to copy a style from one document to another.

The process involves finding an obscure Organizer dialogue:

  1. Open the document you want to copy the correct style from.
  2. In the Styles ribbon group, click the breakout arrow in the bottom-right corner to open the full set of Styles options.
  1. Click on the “A with a tick”, which opens the Manage Styles dialogue.
  1. From here click Import/Export… and it will open the Organizer.
  1. Close the file on the right hand side (we don’t want to use the default Normal.dotm).
  1. Open the file that you want to copy the style to – you may need to change the filter from Word Templates to All Word Documents.
  1. Select the style to copy, click Copy -> and then Close.

Your “problem” document should now be able to use the style you copied across from the “known good” document.

Sorting a Word table of names, in Excel

This content is 2 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’m going to share a secret with you all, dear readers. I really like Microsoft Excel.

There, I’ve said it. Excel may not be the perfect tool in some scenarios (take my example last year, which should almost certainly have used Power BI) but it is the “Swiss Army Knife” of the IT world. End users and IT admins alike have taken the humble spreadsheet programme and twisted it to suit their purposes. I can do so many things with it.

The problem – a table of names in Word

Like a few weeks ago, when I was reviewing a document. The document contained a table with a list of stakeholders. So as not to offend (in a very hierarchical organisation), it had been decided that the names should be in alphabetical order. Except the author had done that by first (given) name, not by last (family/surname) name. Rather than going back and asking them to fix it, I decided I would do so – as it should only take a few minutes.

Word tables are not always that easy to work with, but copying the data into a spreadsheet would let me mangle it, and then paste it back again. Incidentally, Visual Studio Code is also a fantastic text editor and I often use it for complex search and replace operations.

Moving the data to Excel for processing

In this case, I took the two columns from Word (Name, Job Title) and pasted them into Excel. That gives me something like this (massively simplified for the purposes of this blog post – I wouldn’t really go to this much effort for a three-line table! I also made up the names for this example…):

Mark WilsonPrincipal Architect
Brendan ClarkeDirector
Roger QuinnManager

Splitting first and last names

Next, I added a column to the right of Name, and split the Name column, using Excel’s Text to Column wizard and a space as a delimiter. That gave me separate columns for First Name and Last Name.

MarkWilsonPrincipal Architect

Sorting the data

I then sorted the data on Last Names:

MarkWilsonPrincipal Architect

Combining first and last names

Next, I used Excel’s Concatenate function to merge the sorted names back into a single field, for example:


The result is something like this:

BrendanClarkeBrendan ClarkeDirector
RogerQuinnRoger QuinnManager
MarkWilsonMark WilsonPrincipal Architect

Moving the processed data back to Word

Finally, I took the processed data and copied/pasted the combined Name and Job Title text back to Word.

NameJob Role
Brendan ClarkeDirector
Roger QuinnManager
Mark WilsonPrincipal Architect

Featured image by PublicDomainPictures from Pixabay.

Short takes: iPhone broadcasting wrong number; fractions in HTML; Word comment authors

This content is 7 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Another collection of things I found on the Internet that might or might not be useful for other people.

SMS and phone calls using the wrong number on an iPhone

In common with most people who “work in IT”, I get called upon for family IT support. In truth, I get called upon a lot less since my trainee geek (aged 12¾) deals with most of that for me! Last weekend though, he was stumped by the problems my Mother-in-law was having with her iPhone.

She’d bought a new phone and changed providers, then ported her number to the new provider. Although calls were reaching her with the correct number on her SIM, SMS and outbound calls were using the temporary number allocated prior to porting her “real” number.

I found the solution via the Giffgaff forums – where essie112mm describes a combination of steps including turning iMessage and Facetime on/off. The crucial part for me was Settings, Phone, My Number – where I needed to edit the number to the one that we wanted to use.

Writing fractions in HTML

In the previous section, I wanted to write ¾ using the correct HTML. As it happens, WordPress has taken our my HTML ¾ and replaced it with a raw ¾ symbol but I found this article by Charles Iliya Krempeaux (@Riever) useful reading for representing less common fractions in HTML.

Microsoft Word removes the author name from comments

I write a lot of documents in my professional life. I review even more for other people – and I use the reviewing tools in Microsoft Word extensively. One “feature” that was frustrating me though was that, every time I saved a file, my comments changed from “Mark Wilson” to “Author”.

My colleague Simon Bilton (@sabrisual) pointed out the fix to me – buried in Word’s options under Trust Center, Trust Center Settings, Privacy Options, Remove personal information from file properties on save (thanks to Stefan Blom in this TechNet forum post).

Remove personal information from file properties on save

It seems that our admins have set this by Group Policy now so I won’t have the problem any more but it’s a useful one to be aware of…

Bids, tenders, requests for information and word counts…

This content is 7 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I won’t go into the details (internal company stuff that shouldn’t be on a blog) but at the moment I’m working on a lot of bids, tenders, requests for quotations, requests for information, etc., etc.

I’ve done this sort of work before and it’s not a great fit for me but sometimes it has to be done. It’s my turn. But I hadn’t realised until recently why it is that I struggle so much…

Over the years, I’ve learned to deal with ambiguity; I’ve learned how to respond without having all the facts. I can write convincing copy (at least I think I can) and I can usually spell (despite a colleague suggesting yesterday that I should check a dictionary because “siloes” didn’t look right to him and maybe it should be “silo’s” – arghhh!).

It was my wife who pointed out to me that the very same attributes and skills that help me as an architect (general pedantry; taking the time to consider the various consequences of choices made; a desire to put in place controls to get things right and to do them well) hinder me in a high-pressure sales environment where I don’t have time to think and where everything is urgent/important and needs to be done NOW (or very soon after now)…

…and relax. Because it’s Friday night. And, in a short while, I will have a beer, or a glass of wine, in my hand.

Anyway, what is the point of this drivel? The ranting ramblings of an Architect? No. Ah, yes, word counts.

Counting words in a document – or in a cell in a spreadsheet…

Lots of bid responses are limited in the number of words that can be accepted. Often, the tool I’m using is Microsoft Word and it’s pretty easy to show the word count for a document or part of a document. Sometimes though, I’m using a different tool to create a document. Like Microsoft Excel.

I was working on a form of response that lists several skills and requires a response of less than a hundred words for each. Sounds easy? Maybe, but thirty 100-word responses are still 3000 words… and only having 100 words to detail experience can be limiting sometimes.

I needed a method to count the number of words in a cell of the spreadsheet and, as usual, I found the answer online:

=IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)

Basically, this compares the length of a string with the length of the same string with all the spaces removed and adds 1 (for a single word with no spaces) or returns 0 if there is nothing in the cell (the TRIM function removes any extra spacing). It’s pretty crude but assuming no hyphenated words or solidi (oblique slashes) it will give a good enough count of the number of words in the cell. Definitely a time-saver for me…

Bonus tip

Excel does have a spell checker – it’s just not very obvious. Just press F7 (or go to the Review menu, then choose Spelling). This only works in the desktop client – not Excel Online.

Short takes: search for new lines in Word; fix HTML <code> text wrapping in CSS; hidden elements in a WordPress theme

This content is 9 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Another mini-blog post under the “short takes” banner…

Search for new lines when reformatting text in Word

Unix admins will probably scoff at me as they can probably cat, awk and sed this (or something like that) but I needed to take a list of values from a web page and convert them to a list in a single command earlier this week. The basic steps I used were:

  1. Copy text from table on HTML page
  2. Paste into Excel
  3. Delete unrequired columns
  4. Save as text

That gave me a file with a list of values (in this case a list of audio or video file formats) but it was one column and I wanted a row to include within some very long PowerShell commands.

  1. Open in Word
  2. Find ^p and replace with ,

The way that this works is that ^p will search for new lines in Word (actually, it’s looking for new paragraphs, and ^l will find a new line). This worked for me in Word, but not in WordPad.

Wrapping text in HTML code snippets

For years (ever since Garry Martin wrote a one of his guest posts on this blog), I’ve been using a WordPress plug-in called DirtyCode to format code snippets that wrap to multiple lines.

The plug-in is no longer maintained though, and WordPress’s visual editor strips out the <dirtycode> tags so I’ve been wanting to fall back to the standard HTML <code> tag. Unfortunately that doesn’t text wrap in my theme, so I had to find a way to stop long lines of code running out of the frame.

The fix (or maybe it’s a fudge – if I could work out how to make custom CSS stick on theme changes, I would) was to edit my WordPress theme’s stylesheet (style.css) to include the following inside the existing code { } line:

word-break: break-all; white-space: pre-wrap;

Hidden elements in a WordPress theme

On a related note, I had some issues with elements not displaying properly in my new theme either. The WordPress forums came to my rescue though – it seems the tag line that I couldn’t see was there but hidden, until I added the following code to the custom CSS:

.site-description { color: #CCCCCC; display: block; }

Short takes: refreshing all the fields in a Word document; fixing the spacing after a table in Word

This content is 9 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

More snippets of info from the last few weeks… this time with a focus on Word…

Refreshing all the fields in a Word 2013 document

I was writing a pretty sizable document recently, with many tens of tables, a few figures and lots of cross references so I wanted to be able to easily update all the fields in one fell swoop. Well, it turns out to be remarkable easy to do, if not immediately obvious, in Word 2013 (and it seems it works for older versions too). Just go to Print Preview and the fields will be updated!  You’ll still need to manually update tables of contents, etc. if you’ve added/removed sections, but all the other fields in the document will be taken care of.

Fixing the spacing after a table in Word

Another challenge I had with my document was that it included a lot of tables, and after each table the following line was too close.  If I included a blank line, it was too big (and anyway, that’s not the right answer); and if I edited the Normal style then it would affect the rest of the document.

I found some suggestions in a post from Allen Wyatt. The first was to amend the table positioning and set top and bottom spacing but that involves letting text flow around the table (and potentially tables floating off around the document in the same way as so many pictures do…). The simpler approach was to create a new style, based on Normal, called After Table, which has the appropriate paragraph spacing set. No more ghastly gaps and dodgy new lines – instead I just use the After Table style on the paragraph immediately after each table.

Short takes: text editing; Windows Phone; and recovering deleted images…

This content is 10 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

More snippets from the life of a geek playing at being a manager in the IT industry…

Replacing text with a carriage return/line feed in Windows Notepad

It’s a long story but I needed to find out how many people are in our department, at a level above me.  My manager is on holiday, so I couldn’t ask him. Instead, I drafted an email to the whole department, expanded the distribution list and then counted the names…

Of course I didn’t quite do it like that… I pasted the list into a text file (which I thought I’d import to Excel as a CSV and then count the number of rows). That didn’t work out (I got 111 columns instead and I lost count shortly after AA, AB, AC, etc.) so I tried replacing the “; ” with line feeds in Notepad. Notepad can’t do that, but Word canCtrl+H will open the find and replace dialogue and using ^p as the string for the replacement will insert a new paragraph mark. 111 replacements were made (hence 111 names).

Changing the voicemail number on my Windows Phone

One of the issues with my iPhone is that I can’t change the voicemail number from 901 (O2 – the network my phone thinks it’s on) to 443 (Giffgaff – the MVNO that my account is actually with).  I’ve jailbroken and hacked around with config files but it doesn’t work on iOS 7.0.4.

Thankfully, my Nokia Lumia 625 (running Windows Phone 8) is a little more flexible.  When new, it asked me what the voicemail number I needed was.  In the absence of any information from my service provider (EE), I googled and found information that suggested it was +447953222222. My IT department later suggested I should use +447973100123 and changing it is as simple as hitting the ... in the phone app and entering settings, then changing the voicemail number.  As my messages are still intact, I guess that both numbers actually end up in the same location…

Turning off Twitter’s lock screen updates on Windows Phone

Talking of Windows Phone, when I installed the Twitter app it asked if I wanted to see selected tweets on my lock screen.  It seemed like a good idea at first, until I realised I couldn’t actually click on them.  Turning off the Twitter lock screen updates was difficult to hunt down – it’s not set via the Twitter app settings but in the lock screen settings, as Jamie Thomson (@jamiet) and Craig Hawker (@craighawker) highlighted to me.  Thanks guys.

Recovering deleted images from a camera flash drive

Of course, any of us who work in IT know that we automatically get to provide a family IT support service.  I shouldn’t complain because, after my parents in-law paid for someone to do some work on their PC I was horrified to see that he had removed Microsoft Security Essentials and added AVG (which I had removed because it kept nagging to upgrade to a paid version), installed a load of unnecessary software (Defraggler, Firefox, etc.).  My “keep it simple, stupid” approach to septuagenarian IT had been destroyed by someone who wanted to inflict his way of computing on others.

Anyway, back to the point…

…My Mother in-law was disappointed to find she was missing some images on her digital camera.  She swears the camera did it by itself (I suggest it was user error) but, critically, no new pictures had been taken since.  Following advice from PC Advisor, I used a free application called Recuva to restore the deleted files on the memory card (ironically, from the same software company that creates Defraggler, the tool I said was unnecessary a little earlier).  It was beautifully simple, although I was unable to get Windows to recognise the camera as a drive (it does depend on the camera) and had to mess around with card readers instead.

Short takes: searching in Outlook; duplexing in Excel; merging in Word; and going wild in Salesforce

This content is 11 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

This week I’ve mostly been… working in pre-sales. Consequently, this is perhaps not the most exciting blog post I’ve written… but hey, it’s a post and there haven’t been many of them recently!

First up: searching Outlook

Since I changed jobs in April, my email volume has increased by 300x. My mail archive has more messages in it as we approach the end of June than it did for the whole of 2012, and most of them have been sent/received in the last three months.  In short, being able to quickly and accurately search Outlook is important to me.

Microsoft’s website has some good advice for narrowing search criteria for better results in Outlook – for example, if you’re looking for that email from Mark Wilson with the attachment you needed? Try from:"Mark Wilson" hasattachment:yes.

Next: opening two Excel workbooks side by side

If someone sends you a spreadsheet that you need to complete, and there’s information to pull from another spreadsheet, it can be a nuisance to keep switching back and forth between windows inside the application. The answer is to use Task Manager (taskmgr.exe) to open a new copy of Excel so you now have two running processes.  Each one can be used to open a different workbook (e.g. on different monitors) and contents can be copied back and forth.

Then: merging revision comments in Word

Perhaps you work in a team where instead of collaboratively editing one document, people each create their own versions with their own comments? Thankfully, Word 2010 (and probably other versions too) can merge the comments and changes into a single document. That single feature saved me hours this morning…

Finally: wildcards in reports

My final tip from “Mark’s exciting week in pre-sales” (I jest) was gleaned whilst trying to create a report in to show my team’s pipeline. I can’t rely on opportunities being correctly tagged, so I needed a report that used searches on a number of fields (and a filter to apply Boolean logic) but was picking up some false positives.  The problem was that one of the search criteria was also a partial match on some other results.  By changing the “contains” criteria from thing to thing*, I got just the results that started with “thing” and not the ones that included “thing” (like “something”).

That explanation is not as clear as I’d like, but I don’t want to spill the beans on some proprietary information – just take a look at the advice for refining search using wildcards.

Greyed out button for adding bookmarks in Microsoft Word

This content is 12 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

This week, I finally put the finishing touches on a white paper I’ve been writing for my employer (once it’s published, I’m sure I’ll be linking to it). Usually, the stuff I write is fairly straightforward – nothing more complex than a Word document with associated styles, a table of contents, the odd field here and there, a few cross references. This time though, I found myself using some functionality that I’ve not used previously – like the citation/biblography functionality and also some bookmarks (to refer to sections of the document that weren’t labelled as headings or captions).

I couldn’t work out why adding bookmarks was not available (the Add button was greyed out) but the trick is to ensure that the bookmark name has no punctuation in it (except an underscore).

Changing Word’s bibliography style to use square parentheses

This content is 12 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

One of my main activities right now is writing a white paper discussing how linked data potentially provides a solution to one of the problems that big data creates. I’m sure I’ll tweet the link when it’s published but, for a sneak preview of the main points, check out my lightning talk at CloudCamp London next week.

Unlike most of the stuff I create these days, it’s written for architects, rather than for a CIO/CTO and so the style is more of a technical journal than a piece of marketing collateral. That’s meant lots of graphics and fully-detailed sources. I’ve never used the citation capabilities in Microsoft Word before (I did write my dissertation in Word 2.0 for Windows, but that was in 1994 and it was still fairly feature-light then!) but I’ve been pretty impressed at its ability to create a bibliography for me.

Word lets me choose from a variety of bibliography styles but I have chosen ISO 690 (Numerical Reference). The only problem with this is that it uses normal round parentheses () rather than square parentheses [] which can be confusing when a sentence contains both text in parentheses (brackets) and a citation (1).

Custom Word 2007 bibliography styleA bit of googling turns up various solutions involving editing XSLT stylesheets but that all seems a bit of a pain. Then I found that “Yves” on CodePlex has already done the work and released ISO690NmericalSquare.XSL.  After downloading this to %ProgramFiles%\Microsoft Office\Office12\Bibliography\Style and restarting Word (2007 in my case – there’s anecdotal evidence to suggest it would work for Office14/2010 too), I have a new option in the bibliography style dropdown and my citations are all labelled with square parentheses.