Export to .docx creates styles

Hi,

I’m trying to understand how to deal with styles while exporting to work with my publisher.

In Scrivener, I have my specific list of styles used in the text.
I export to docx and then open the file with Pages, since I don’t have Word.

There, I can find my own styles, but quite a large list of new, used ones are created too:
Title, Title 1, Title 2, Red Title, and so on.

When I create a new document from scratch on Pages, those styles are not there, so they really come from the document created by Scrivener.

Is there a way to change that, make it that the .docx created by Scrivener only contains styles I created?

Thanks for your help

Those appear to be default styles from the Pages app. You can change them as you like, but I caution against deletion, as I don’t know if they can be replaced.

No, they are not default Pages styles, as they are not here if I create a new document in Pages.

They only appear in .docx files generated by Scrivener, hence my question.

Past posts have said that the compile to DOCX format is not perfect. Reasons stated, but I forget. As a work-around, does it suit you to compile to RTF and then open that file in Pages?

1 Like

Thanks for your answer.
I can try but I don’t think so because my novel mixes different styles including movie script formats and if I remember correctly those are not supported in RTF files…

MacOS 15.4

  1. Open Pages
  2. Select File > New
  3. Select Blank and Create
  4. Resulting document styles:

:slight_smile:
Mark

2 Likes

You are correct. Styles don’t seem to carry across to RTF. I wasn’t sure. Long time since I did that.

For what it’s worth. I made a test Scrivener Project and assigned styles Heading 1, Heading 2, No Style, and “Special Style” being something I made up. Results:

  • RTF → Open in Pages. Formatted correctly but style names all Body*
  • RTF → Open in Word. All ok. Formatted correctly with all correct style names assigned
  • DOCX → Open in Pages. All ok. Formatted correctly with all correct style names assigned
  • DOCX → Open in Word. All ok. Formatted correctly with all correct style names assigned

I don’t know how LibreOffice might work for you. Free of license cost. I don’t use it.

My problem is not that my styles are not exported correctly, it’s rather that in addition to my own styles, I have at least twenty more, that were not in my Scrivener project, that are not in use in the document (and not present by default on Pages), but that are created when I export from Scrivener to a .docx which I open with Pages.

I’d like to get rid of those :blush:

Yes, those are the default styles in a blank Pages.
However, this is what I get when I export a .docx in Scrivener that I open in Pages :

In the red square, my specific styles from Scrivener.
Can you see how many more are created in the process ?..

2 Likes

Ah, I see now. Unlike Word, there is no way I know of to hide un-used styles in Pages. And, I have no idea how Scrivener would have created these styles, but apparently it did. You can simply delete any styles un-used an un-wanted?

Scrivener doesn’t create these styles; I presume they are part of the Pages default (though my results are slightly different from @chaarrliie’s). To test this, I imported a DOCX created in Word sent to me by a Word-using collaborator into Pages and this is the Styles list:

Opening the same DOCX in Nisus Writer Pro, gives this style list.

Clearly, many of the Styles in the first image are from Pages.

:slight_smile:
Mark

2 Likes

Scrivener’s native format is RTF. We have an RTF → DOCX converter, which gives the results you see in Word. But the DOCX → Pages conversion is not us, it’s Pages. Any differences between what you see in Word and what happens when you open the same file in Pages are Apple’s responsibility.

(Since Apple has not published the Pages format, we have no knowledge of and no ability to control what they do with a DOCX file.)

1 Like

I don’t have Word to check, but my publisher, who has it, said that they were there, so it really is Scrivener creating those in the process…

Absolutely not. My tests show that similar random styles appear in Pages on importing a DOCX that hasn’t been anywhere near Scrivener!

2 Likes

With a little technical digging we can determine exactly what Scrivener is doing. Looking at this through the distorted lens of whatever a word processor is going to do on top of that, isn’t a reliable test, as we will see.

Examining DOCX contents...
  1. From a simple test that makes use of Body and Heading 1 alone, I compile to .docx.

  2. In Terminal, I change directories to my general testing and compile output folder “inbox”, then make a new folder within it, change into that directory, and unzip the compiled .docx into it.

    mkdir ~/inbox/docx_contents; cd ~/inbox/docx_contents
    unzip ../compiled.docx
    
  3. This extracts a lot of files, a .docx file is a bit like a .scriv project, only it is zipped into a single file instead of left as a folder. The internal file we are looking for is going to be in the ‘word’ subfolder of the docx: ‘styles.xml’.

  4. Opening this file in a plain-text editor, we can search for the text, w:styleId=, which is how individual styles are identified. Scrolling through all of those hits will show us which styles are actually declared in this document (whether they are used or not is beside the point).

The listed styles we find in the .docx itself are:

  • Normal: this is, as far as I know, a requirement for a .docx file to have. It is a fallback.
  • Default Paragraph Font: same as above, though do note this style has special attributes set to hide it until used. Some word processors may not respect that setting.
  • Heading 1: we used that one, so it should be there.
  • Body: we used that one too.

And that’s it. The two styles I used (and no other styles from the project), and a couple of required fallbacks.

If I open the original .docx in LibreOffice, and set the styles filter to “Applied Styles”, I get the two I used, plus a few LibreOffice requirements. It needs some header and footer styles, as well as its default fallback, ‘Default Paragraph Style’, but the exact listing would change depending on content; e.g. if I had footnotes I would see its default ‘Footnote’ style.

I could change the filter to “All Styles”, but that doesn’t show me the document’s stylesheet, rather LibreOffice’s library of stock example styles. I will get those in a new empty document as well. If I use a template on the other hand, I may not get that library—the “Simple” template for example has a master stylesheet list of about 15 styles, whereas the default has pages and pages of them. Consequently if instead of loading the .docx file, I create a simple template and then import the .docx into that template, I only get the Body and Heading 1 styles I used, added to its list of ~15, instead of the massive stock library I get when loading the file plain.

Some word processors may allow you to modify the stock library, that gets added to converted documents, like Word’s normal.dot file.

@chaarrliie : I don’t have Word to check, but my publisher, who has it, said that they were there, so it really is Scrivener creating those in the process…

Presumably Pages is saving these styles into files you open with it.

3 Likes

But why are the unused styles bothering you (or your publisher)?

1 Like

Seems to me that Pages—which I have to say I’ve never really liked or got on with… I have it as a failsafe—has taken over the mantle of the previous, un-regretted Microsoft .DOC in using a proprietary and unpublished, presumably binary, format.

:grin:
Mark

1 Like

Because there are too many of them, it’s hard to spot our own and we need to give a clean file with only used styles to the graphic dept

Thanks for your time.
If I understand correctly, you are saying that it’s the conversion .docx to .pages when Pages open the document that creates all those styles, which don’t exist in the Scrivener project nor in new Pages files ?

Yes, that does seem to be what is going on. From my testing, if you export to DOCX from Pages, after modifying what was imported, it will do like Scrivener does and only add the styles you actually used while editing, to the styles.xml file.[1]

But if you save as .pages format and then dig into its format, you will find all of these stock styles actually saved into the document (at least, as best I can tell; as Mark noted above, Pages is a bunch of undocumented gibberish).

Overall I would say this behaviour is common to word processors because, on the whole, it is desired to have useful styles available. Otherwise you might open a document you wrote years ago, and notice a block quote isn’t formatted right, so you go to apply the style—but it’s not there because you never used it. Now you have to spend 15 minutes in formatting palettes making it… or if the software always adds twenty or thirty common presets to imported documents, you can just click a button to get your block quote.

That said, I don’t know why anyone at Apple thought “Red Title” is something hoards of people would often find useful to easily apply. Indeed most of the list is kind of weird in my opinion. :laughing:

Oh, and as for why you may get something different when creating a new document from scratch in Pages, I don’t know how to use the software, but it’s not unusual for a word processor to have some way of changing the default new document template. My results are the same as others have posted above, I see these styles when I press ⌘N and select Blank. But if I select Simple Report I get a stylesheet that matches what the document needs and nothing more.

What you get from a new document may not match the stock library of styles added to imported documents. As far as I can tell Pages has no concept of a default new document anyway.


  1. Word, upon opening it, may add stock styles of its own to the list, but there shouldn’t be any of the Pages-specific styles in there—unless maybe there is some setting in Pages I’m unaware of. ↩︎

1 Like