I was wondering how I keep my text styles when creating a Word target.
Specifically, I can start with a Word Doc, Import it to Mad Cap, and it keeps the style tags (Heading 1, Heading 2, etc...). But when I turn the Flare topics back into a Word document, it loses the style formatting.
Keeping Styles When Sending to Word Target
-
- Sr. Propeller Head
- Posts: 290
- Joined: Mon Aug 26, 2019 2:11 pm
Re: Keeping Styles When Sending to Word Target
It actually still keeps them, it just outputs them in a different way. They won't be the standard Heading 1, Heading 2 etc - they'll appear in the style picker in Word as h1_heading1, h2_heading2, etc. I don't think Flare can map them back to their original positions because the styles are encoded completely differently.
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
-
- Propellus Maximus
- Posts: 1238
- Joined: Mon Feb 27, 2006 5:56 am
- Location: Melbourne, Australia
Re: Keeping Styles When Sending to Word Target
Flare does not map directly to Word styles - as mentioned it uses h1_heading1 and so on.
We have a set of macros that we run in Word to do the conversion after export.
Can post the code if you like.
We have a set of macros that we run in Word to do the conversion after export.
Can post the code if you like.
Margaret Hassall - Melbourne
-
- Senior Propellus Maximus
- Posts: 2632
- Joined: Wed Apr 14, 2010 8:01 am
- Location: Surrey, UK
Re: Keeping Styles When Sending to Word Target
As a general rule, you can't keep importing and exporting between Word and Flare, because they really don't like each other. (I blame Word - it doesn't do html properly.) I'm guessing you'd be able to do some snazzy macros, but I've found that what you get in Word out of Flare varies greatly depending on the individual styles used in each topic, so I was never able to define what Word has done, so couldn't write sensible macros and just ended up changing the formatting manually. This is particularly painful if you have lots of procedures or similar that use lists.
Word's way of dealing with lists is currently making me cry. (Can you tell?)
Word's way of dealing with lists is currently making me cry. (Can you tell?)
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Re: Keeping Styles When Sending to Word Target
OK, I understand what you're saying. I guess retro fitting my styles will have to be the answer. If you could post the code you are referring to I would appreciate it.wclass wrote:Flare does not map directly to Word styles - as mentioned it uses h1_heading1 and so on.
We have a set of macros that we run in Word to do the conversion after export.
Can post the code if you like.
-
- Propellus Maximus
- Posts: 1238
- Joined: Mon Feb 27, 2006 5:56 am
- Location: Melbourne, Australia
Re: Keeping Styles When Sending to Word Target
This routine will convert all html headings to equivalent Word headings.
I maintain a separate template (publishing-tools.dotm) to store the code but you could put the macros in Normal.dotm if you really want. I keep it in my Word Startup folder and link to the macros from the ribbon so I always have access to them.
I maintain a separate template (publishing-tools.dotm) to store the code but you could put the macros in Normal.dotm if you really want. I keep it in my Word Startup folder and link to the macros from the ribbon so I always have access to them.
Code: Select all
Sub stl_convert_all_StandardHeadings()
' ----
' This routine converts web-type headings (H1) to standard Word ones (Heading 1),
' in the current active document.
' It loops through the document checking the style of each paragraph found,
' updating as it goes.
' Default is to convert all 6 levels of headings (H1 - H6).
' This includes the subclasses of H1-6 as well (h1_something)
Dim rngSave As Range
Dim tPara As Paragraph
Dim tStyle As String
Dim newStyle As String
Dim stylePrefix As String
' save current location
Set rngSave = Selection.Range
For Each tPara In ActiveDocument.Paragraphs
tStyle = tPara.Style
If Len(tStyle) <= 2 Then
stylePrefix = tStyle
Else
stylePrefix = Left(tStyle, 3)
End If
Select Case LCase(stylePrefix)
Case "h1", "h1_"
newStyle = "Heading 1"
Case "h2", "h2_"
newStyle = "Heading 2"
Case "h3", "h3_"
newStyle = "Heading 3"
Case "h4", "h4_"
newStyle = "Heading 4"
Case "h5", "h5_"
newStyle = "Heading 5"
Case "h6", "h6_"
newStyle = "Heading 6"
Case Else
newStyle = ""
End Select
If newStyle <> "" Then
tPara.Style = newStyle
End If
Next tPara
' return cursor to original location
rngSave.Select
Selection.Collapse
End Sub
' -----------------------------------------------------------------------------
Margaret Hassall - Melbourne
-
- Propellus Maximus
- Posts: 1238
- Joined: Mon Feb 27, 2006 5:56 am
- Location: Melbourne, Australia
Re: Keeping Styles When Sending to Word Target
And here is another one that converts all "p" and "p_*" to normal paragraphs
Code: Select all
Sub stl_convert_all_paras_normal()
' ----
' This routine converts web-type paragraphs (p, p_1, p_2, etc) to Word Normal
' in the current selection in the active document.
' It loops through the document checking the style of each paragraph found,
' updating as it goes.
Dim rngSave As Range
Dim tPara As Paragraph
Dim tStyle As String
Dim newStyle As String
Dim stylePrefix As String
' save current location
Set rngSave = Selection.Range
For Each tPara In ActiveDocument.Paragraphs
tStyle = tPara.Style
If Len(tStyle) <= 2 Then
stylePrefix = tStyle
Else
stylePrefix = Left(tStyle, 2)
End If
Select Case LCase(stylePrefix)
Case "p", "p_"
newStyle = "Normal"
Case Else
newStyle = ""
End Select
If newStyle <> "" Then
tPara.Style = newStyle
End If
Next tPara
' return cursor to original location
rngSave.Select
Selection.Collapse
End Sub
Margaret Hassall - Melbourne