Step 1: NNELS Template for Word

Let's make some books.

Re: Step 1: NNELS Template for Word

Post by
rmarion
»
Wed Feb 14, 2018 4:41 pm
I was surprised it worked so easily with the mac for the most part. I believe there were 33 or so different styles and after deleting the styles that could be deleted, there were still at least six. I think the reason I could figure it out was that the mac version of word has both the ribins and the menue bar at the top like other programs for the Apple. Now to the more dificult task deleting the formatting and hyperlinks from the document.

Talk to you all tomorrow.

Richard
rmarion
Posts: 62
Joined: Fri Feb 02, 2018 1:08 pm
Contact:

Re: Step 1: NNELS Template for Word

Post by
Daniella.LP
»
Thu Feb 15, 2018 11:47 am
Hi all,

I was able to replace the style of the .docx file with the NNELS style using Pandoc (I will post how I did it in a separate topic, so that this thread remains for Word templates).

I like the idea of using a macro to simplify the process of deleting all the styles at once. I read everyone's comments and looked for other alternatives, but nothing seemed to work for me. I selected all the text to delete the styles but every time I did so, Word crashed in my computer. I would still like to learn how to do this directly from Word in Windows.

I am using Word 2016 and JAWS 18. After pressing alt H F Y I could see the list of stiles and move through all of them with the up and down arrow keys; JAWS indicates that each one has a pup up; the first item in the list is clear all and the last one is header. But I have not been able to find the context menu after selecting a style to get to the delete option. What am I missing? Pressing tab, I found a "disable link styles" check box. I checked it but did not get any confirmation . The options link opens the style pain options, with a couple of combo boxes (select styles to show, select how list is sorted) and a few check boxes, the last one is only in this document.

I also tried a different command: alt h l (which took me to the styles group box, a grid with the same styles shown in the list I mentioned above, the one I had found thanks to Steve (alt h f y). But I could not find any further options there either. Any guidance to find the delete options would be appreciated. I understand that it is not possible to clear all the styles at the same time, but I did not get any confirmation that what I did for one of the styles even worked.
Daniella.LP
Posts: 77
Joined: Sat Feb 03, 2018 6:20 am
Contact:

Re: Step 1: NNELS Template for Word

Post by
steve.murgaski
»
Thu Feb 15, 2018 1:35 pm
Hello Daniella. I'm excited to check out your thread about the Pandoc program. I was also unable to get to the organizer through the other style pains in Word - only the alt-h f y one lets me tab to it. Once I get to the organizer that way I see a list of styles, like you said, and tabbing when a style is selected brings me to a delete button. The button can also be activated by pressing alt-d. That lets me highlight and delete the styles individually.

Best of luck.
steve.murgaski
Posts: 31
Joined: Wed Feb 07, 2018 3:25 pm
Contact:

Re: Step 1: NNELS Template for Word

Post by
rmarion
»
Thu Feb 15, 2018 3:01 pm
Hello Daniella and others. I am not sure if you have posted your new topic yet as I can't seem to find it. But I wanted to let you all know that I was able to delete the document formatting today on a PC. I opened the home ribin and went to the fonts tab. There, you will find an option to delete all document formatting. I think someone tried this yesterday and their computer froze. I selected all text before finding the button. It appeared to work as my document now has no headings. Also, if anyone has not deleted the hyperlinks, you do this by highlighting the entire document and then just pressing control Shift and the F9 Keys. Again, there is no verbal confirmation but a search through the document for links will show you that the command did work.
rmarion
Posts: 62
Joined: Fri Feb 02, 2018 1:08 pm
Contact:

Using Pandoc to produce .docx with NNELS style

Post by
Daniella.LP
»
Thu Feb 15, 2018 4:06 pm
I used Pandoc in order to replace the style of the document with the NNELS style. The process can be done in one step, directly from the .epub file, but I started from the .docx file that we all received by email from Sabina.

I have used Pandoc quite a bit to produce many Word documents, including some with specific styles, directly from a text file that I create using Markdown (which uses punctuation symbols to indicate text attributes). In my experience, Pandoc is a more reliable tool than Word itself, in terms of generating documents that are consistently formatted: I know that the style I want will be applied to the resulting file, and I don't have to worry about Word making assumptions about the format if I move something without noticing. Some editing of the resulting .docx file may be necessary, but I find the process much simpler than trying to apply a complex format to a document in Word by hand.

I try to use short file names to make the code simpler, but you can have longer file names; however, it is important to ensure that the file names do not have any spaces (I use underscores, or capital letters to name the files). Also, I always work from a specific folder, where I put the source file, as well as the one that I use as a reference for the styles in Word; the resulting file will be in that folder.

Here are the steps I followed to change the styles in the .docx file.

1. I opened the "nnels_styles.dotx" file in Word and then I saved it with a different name "nnels_s.docx" (note that the file is now a full .docx file, no longer a template.

2. Close that file (made sure that it is in the desired folder). This file will be the reference, the styles from this file will be applied to the file we want to modify.

3. open Windows Powershell or the command line and make sure you are in the desired folder. I typed "cd documents" and press enter; because I am working in a folder which is inside the documents folder, I need to do the same to move to it and so I type "cd MyMarkdown" and pressed enter.

4. Typed the following command: "pandoc -S --reference-docx nnels_s.docx -s A_Hughes.docx -o A_Hughes2.docx"

The first.docx file is the one with the reference style; the second file is the one we want to modify; and the third .docx file is the output, so I added a 2 to distinguish it from the one containing the styles we do not want.

Using Pandoc and slightly modifying the command above, we can convert the .epub file to a .docx file, and apply the desired nnels style in one step. To do that, the three first steps would be exactly the same, the only difference would be in the fourth step, the specific command. It would be as follows:

"pandoc -S --reference-docx nnels_s.docx -o Hughes.docx Hughes.epub"

The first .docx file is the reference for the style; the second .docx file (preceded by "-o " is the result, or the output file; and the last part of the command is the source epub file that we are converting.

I hope this is useful. It took me a bit of time to be comfortable with Pandoc but I use it all the time now.

I do not mean to suggest that the resulting .docx file will be completely ready; there will still be specific things that will need to be edited but thanks to this process I was able to produce a copy of Hit the Ground Running that for the most part has the NNELS desired styles that I can now edit.

I still have to delete the style and replace it with the NNELS template from within Word.
Daniella.LP
Posts: 77
Joined: Sat Feb 03, 2018 6:20 am
Contact:

Re: Step 1: NNELS Template for Word

Post by
Daniella.LP
»
Thu Feb 15, 2018 7:35 pm
I was finally able to delete the styles and apply the NNELS template in Word 2016 in Windows. And I found a way to delete all the styles that can actually be deleted together. It may be worth to update the wiki to include specific commands for this version of Word.

1. Open the styles editor by pressing alt h f y.
2. Below the style list, click the "Manage Styles" button. You can do this by tabbing three times.
3. Tab to find an "Import/Export" button and click it.
4. Find the combo box listing all the styles.
5. Press Shift+Control+End to select all the styles in the list.
6. Press the "delete" button. To find it, I recommend that you use Shift+Tab, as pressing Tab will undo your selection.
7. Press "Yes to all" and then click okay to all the prompts for the styles that cannot be deleted.
8. Click the "Close" button to leave this dialogue.
9. To import the NNELS template, press Alt+F, then T to bring up the options dialogue.
10. Find "Add-ins" by pressing down arrow.
11. Find the combo box labeled "Manage" by using the Tab key.
12. Select "Templates" and click the "Go" button.
13. Click the "Attach" button and select the NNELS template.
14. Check the "Automatically update all styles" checkbox.
15. Press the "Close" button to leave this dialogue.
Daniella.LP
Posts: 77
Joined: Sat Feb 03, 2018 6:20 am
Contact:

Re: Step 1: NNELS Template for Word

Post by
steve.murgaski
»
Thu Feb 15, 2018 10:15 pm
I'm really glad there's a way to do this manually. I did find a way to do it with a macro. It was fast and elegant as magic, and I swear I had it working. But I was trying to figure out how to export the macro so it would be easy for other people to install, and for some reason it stopped working. Maybe I'll wake up screaming with joy because I'll realize what I'm doing wrong, but right now I'm stumped.

Here are the instructions. Just replace the word "normal" in his template name with "nnels_styles". (I know how all programmers feel now. I could wander the streets muttering "I swear it was working...")
https://answers.microsoft.com/en-us/off ... 44c?auth=1
steve.murgaski
Posts: 31
Joined: Wed Feb 07, 2018 3:25 pm
Contact:

Re: Step 1: NNELS Template for Word

Post by
farrah
»
Fri Feb 16, 2018 10:58 am
Fantastic. Thanks for the step-by-step instructions Daniella. Noted that we should add this to the wiki!
Daniellalpl wrote:
Thu Feb 15, 2018 7:35 pm
I was finally able to delete the styles and apply the NNELS template in Word 2016 in Windows. And I found a way to delete all the styles that can actually be deleted together. It may be worth to update the wiki to include specific commands for this version of Word.

1. Open the styles editor by pressing alt h f y.
2. Below the style list, click the "Manage Styles" button. You can do this by tabbing three times.
3. Tab to find an "Import/Export" button and click it.
4. Find the combo box listing all the styles.
5. Press Shift+Control+End to select all the styles in the list.
6. Press the "delete" button. To find it, I recommend that you use Shift+Tab, as pressing Tab will undo your selection.
7. Press "Yes to all" and then click okay to all the prompts for the styles that cannot be deleted.
8. Click the "Close" button to leave this dialogue.
9. To import the NNELS template, press Alt+F, then T to bring up the options dialogue.
10. Find "Add-ins" by pressing down arrow.
11. Find the combo box labeled "Manage" by using the Tab key.
12. Select "Templates" and click the "Go" button.
13. Click the "Attach" button and select the NNELS template.
14. Check the "Automatically update all styles" checkbox.
15. Press the "Close" button to leave this dialogue.
farrah
Posts: 41
Joined: Tue Feb 06, 2018 10:50 am
Contact:

Re: Step 1: NNELS Template for Word

Post by
farrah
»
Fri Feb 16, 2018 11:01 am
Thanks Steve. Let us know if you get the macro working again! Installing and using the template is a bit of a pain. I'm all for macro magic.
steve.murgaski wrote:
Thu Feb 15, 2018 10:15 pm
I'm really glad there's a way to do this manually. I did find a way to do it with a macro. It was fast and elegant as magic, and I swear I had it working. But I was trying to figure out how to export the macro so it would be easy for other people to install, and for some reason it stopped working. Maybe I'll wake up screaming with joy because I'll realize what I'm doing wrong, but right now I'm stumped.

Here are the instructions. Just replace the word "normal" in his template name with "nnels_styles". (I know how all programmers feel now. I could wander the streets muttering "I swear it was working...")
https://answers.microsoft.com/en-us/off ... 44c?auth=1
farrah
Posts: 41
Joined: Tue Feb 06, 2018 10:50 am
Contact:

Re: Step 1: NNELS Template for Word

Post by
Daniella.LP
»
Sun Feb 18, 2018 1:18 pm
I asked my husband for help to create a macro to delete the styles in the document and replace them with those in the NNELS template at once. He refined the code that Steve referred to and developed a macro that is working very well for me. The code is pasted below. I have also put the .bas file in the NNELS Production shared Dropbox folder.

Instructions to import and use the macro (I am using Word 2016).

1. With Word open, press Alt+F11 to open Microsoft Visual Basic for applications.
2. Within VBA, press Alt+F and find the "Import file" option or press Control+M.
3. In the dialogue box, you can browse your folders to Find and select the .bas file, in this case "ModuleChangeStyle.bas" and click "Open".
4. Close Visual Basic with Alt+F4.
5. From Word, Press Alt+w, M, V to view the list of available macros, press Down Arrow to find the "Replace styles", and click the "Run" button.

I tested this macro in Hit the Ground Running, as well as in the book I selected for the project and it works like magic indeed!

Note: make sure that no image is selected in the file before running the macro; if an image is selected, the macro will not work.

***Code begins below***

Sub ReplaceStyles()
'
' Replace styles
'
'
' Removes user-defined templates
For Each sty In ActiveDocument.Styles
If sty.BuiltIn = False Then sty.Delete
Next

' Updates template, assumes same location as normal.dotx
Set myTemplate = ActiveDocument.AttachedTemplate
strTemplate = myTemplate.Path & Application.PathSeparator & "nnels_styles.dotx"
With ActiveDocument
.UpdateStylesOnOpen = True
.AttachedTemplate = strTemplate
End With
End Sub
Daniella.LP
Posts: 77
Joined: Sat Feb 03, 2018 6:20 am
Contact:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest