Word DOC import: List Styles

Get help using and writing Nisus Writer Pro macros.
Post Reply
Bob Stern
Posts: 145
Joined: 2006-03-12 12:32:47

Word DOC import: List Styles

Post by Bob Stern » 2013-12-04 23:23:53

Can a macro rename a list style? If so, I think a macro could improve the process of importing MS Word documents that include list formatting.

It appears to me that MS Word has named paragraph styles but does not have named list styles. In Word, paragraph styles include list formatting. In Nisus, Paragraph styles can incorporate list formatting only by reference to a named List style. Therefore, when importing a Word document, Nisus will create both a Paragraph style and a List style for each Word paragraph style that includes list formatting.

This would be perfect except for one shortcoming: When Nisus imports a Word doc, it is not apparent in the list of styles which List styles are associated with which Paragraph styles. Nisus' import function assigns to the list style associated with each imported paragraph style a generic name like "Number list 1" rather than giving it the same name as the associated paragraph style. Furthermore, the associated Paragraph style does not show a link to the List style.

I think the above confusion could be overcome by a macro, run immediately after importing a Word doc into Nisus, that does two things:

For every list style actually used in the document:

1. change the name of the list style to the name of the paragraph style applied to the text to which that list style is applied.

2. modify the paragraph style to add that list style as one of the parameters of the paragraph style.

Ultimately, it would be better to build these steps into the Word import process.

User avatar
phspaelti
Posts: 918
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Word DOC import: List Styles

Post by phspaelti » 2013-12-04 23:40:46

Bob Stern wrote:Can a macro rename a list style? If so, I think a macro could improve the process of importing MS Word documents that include list formatting.
Yes, it can.

Code: Select all

$doc = Document.active
$list_style = $doc.styleWithName ‘Old Name List’
$list_style.setName ‘New Name List’
You can also get all the list styles with a command like this:

Code: Select all

$list_styles = $doc.listStyles
which you could then go through one at a time.
philip

User avatar
phspaelti
Posts: 918
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Word DOC import: List Styles

Post by phspaelti » 2013-12-05 00:00:22

But to get to your main point:
Bob Stern wrote:It appears to me that MS Word has named paragraph styles but does not have named list styles. In Word, paragraph styles include list formatting. In Nisus, Paragraph styles can incorporate list formatting only by reference to a named List style. Therefore, when importing a Word document, Nisus will create both a Paragraph style and a List style for each Word paragraph style that includes list formatting.

This would be perfect except for one shortcoming: When Nisus imports a Word doc, it is not apparent in the list of styles which List styles are associated with which Paragraph styles. Nisus' import function assigns to the list style associated with each imported paragraph style a generic name like "Number list 1" rather than giving it the same name as the associated paragraph style. Furthermore, the associated Paragraph style does not show a link to the List style.
I just tried this with some random document that I got from someone. OpenOffice tells me the document has two list styles applied called "WW8Num5" and "WW8Num6" (Both number lists?). In Nisus these styles show up as "Bullet List 1" and "Number List 1" (indeed one is a bullet list with a fancy Japanese style bullet). What's more this user has everything formatted as "Default Style" (the paragraph style). So apparently things don't really work like you describe above. If I attached either list style to "Default Style" every paragraph in the whole document would be numbered.
philip

Bob Stern
Posts: 145
Joined: 2006-03-12 12:32:47

Re: Word DOC import: List Styles

Post by Bob Stern » 2013-12-05 00:06:39

Thanks for correcting me, Philip!

I inferred that Word cannot create named list styles based on:

1. My copy of Word 2008 for Mac.

2. Word documents I receive from a colleague in Taiwan using some version of Word for Windows. Of course, his failure to use list styles does not mean it isn't possible!

User avatar
phspaelti
Posts: 918
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Word DOC import: List Styles

Post by phspaelti » 2013-12-05 00:14:27

I infer from your description of his document, that your friend in Taiwan is a rare instance of a Word user who knows how to use styles effectively. :)
philip

Post Reply