Importing Word Styles

I am using File-Import to import a Word docx file.

A test document containing nothing but Headings, with no intervening text at all, imports the Headings correctly,

So if the Word doc has the structure just below, with Headings that contain no non-Heading styles between each Heading instance (an entirely abnormal test document), then when the file is imported the Styles are recognized, the formatting is applied, AND (this is crucial) as the cursor moves between those lines, the Styles are indicated in the Style panel and in the toolbar Style field.

Heading 1
Heading 2
Heading 3
Heading 4
Heading 5.

But if there IS content between the Headings, even if that content is nothing but the default Normal text style (as in the structure that follows), the importing of Styles becomes inconsistent. Note that when I refer to Styles, I am talking about actual Styles, that show up in the Style Panel AS Styles, and not merely the underlying formatting of the text, which is retained consistently. But of course while “formatting” may be spoken of as a text “style,” is not the same thing as an actual “Style.” (This adds to the difficulty of consistently describing what is going on, much less figuring out actual program inconsistencies.)

Heading 1
Normal text. Normal text.
Heading 2
Normal text. Normal text.
Heading 3
Normal text. Normal text.
Heading 4
Normal text. Normal text.
Heading 5.
Normal text. Normal text.

The inconsistency seems like it may be related to the presence of blank lines of Normal immediately before or after the Heading (such as if you pressed Enter twice for increased spacing), but even that pattern seems inconsistent.

I have imported an actual realworld, non-test file that uses Headings 1 -5 and Normal, and sometimes the styles are imported correctly and sometimes they are not.

IMPORTANT TO NOTE: In these tests I am using the plain File-Import, and the styles are imported with the inconsistency described above. But when using the much more useful Import and Split function, although the document is correctly split according to the outline defined by the Headings, and the underlying formatting attributes are retained, the “Styles” themselves are not, and all text, regardless its formatting, is shown as No Style. This is consistent with Import and Spit, and means that in order to retain the Styles of a long imported document AND distribute that doc into individual Binder docs, it needs to be manually split at each Style instance – which is made more cumbersome by the fact that even with a straight Import, the Styles are imported inconsistently.

What is the best method for importing an existing, actual, non-test Word document and have it consistently retain not just the text formatting but the actual paragraph “Styles” for Headings and Normal?

Is this an unreasonable expectation?

That does seem to be it, or part of it. I’ve found a definite pattern in how successfully Word Styles are imported into S.

Main doc uses Headings 1 -5 and Normal. That’s all, other than some local formatting, e.g., bold, italic, etc.

Document has many instances of double paras or double “returns” or manual double spacing. Most of those are :“Normal” Style. The very first para in the doc is Heading 1,

When this doc is imported .into Scrivener, not all Styles are brought in. The very first para is now No Style. The Normal text Style is recognized petty consistently throughout, as are some Headings. But maybe half of the routine Headings in the doc came in as either No Style or Normal. (To be clear, the text formatting is correct…it’s the Style “objects” themselves that are not there. The Scriv project contains styles with the appropriate Heading names.)

Next, I start with that same original Word doc, copy and paste its contents into a new Word doc, remove all double paragraphs with a simple search and replace (^p^p for ^p) , then save that.

When I import that into S, it works as expected.

I’ve done several rounds of this now.

It doesn’t seem to be anything that happens in the process of copying the text from the original doc to a new one; I 'd been doing it that way to preserve the original file as is. But after confirming one last time that original file does not correctly import into Scriv, I performed the double para replacement on the original file, saved it, imported it into Scrivener, and all the style came through.

Fun, huh? :mrgreen:

1 Like

Unfortunately, while this seems to have solved the problem of importing a single doc from Word into Scriv and having the Styles keep faith, it had no affect when using the Import and Split, which does not apply to the imported content the very same styles it is using as the basis for splitting the imported document into multiple binder docs. .Is this an option somewhere? It seems like an obvious thing to want, and for the import function to do, given what it’s already doing in the process.

It’s disappointing, because what I want to end up with is a Scrivener binder with this document levels organized according to how the Headings were being used in Word, and which I use in Word to navigate the Document Map panel… For me, Scrivener’s binder IS in effect a multi-document version of Word’s single-doc Document Map, with the ability to create non-linear scrivenings. (which is Scrivener’s .great innovation,) So to have it import the doc with the correct text formatting, and split it in the correct places. and to have the documents’ binder levels correctly conform to the corresponding Word Heading styles – but to NOT have the Headings applied to the imported text… is actually kind of a head scratcher.