I won't put it as a duplicate, because it's not an answered question, but might want to look here:
Is it possible to set a style to show line continuations in Microsoft Word?
which leads you to : Convert HTML to image
Я хочу включить схему XML в технический документ, созданный в MS Word. У него есть строки, которые намного длиннее доступной ширины на странице, поэтому Word автоматически разбивает строки. Я хочу ясно дать понять читателям, где это произошло, чтобы они знали, что следующая строка является продолжением предыдущей. Есть ли способ заставить Word автоматически вставлять символ, например ⏎, в конце каждой автоматически разбитой строки?
Конечно, я мог бы сделать это вручную, но это была бы большая работа, которую я должен был бы повторять каждый раз, когда менялась схема, и это было бы подвержено ошибкам. Я знаю о режиме «показывать непечатаемые символы», но хочу, чтобы эти символы были видны только в этом разделе, а также были напечатаны. Кроме того, «показывать непечатные символы» показывает явные разрывы строк вместо автоматических.
Возможно ли это с помощью MS Word, или если нет, может кто-нибудь порекомендовать другой автоматизированный метод для достижения этого?
I won't put it as a duplicate, because it's not an answered question, but might want to look here:
Is it possible to set a style to show line continuations in Microsoft Word?
which leads you to : Convert HTML to image
Well, you could try the following VBA as a starting point, but I think it will need some work. It assumes that your breaks are always going to be after a space (not unreasonable for a schema IMO) so if you have spaceless text longer than a line you might still have to break those by hand.
This replaces final spaces by the return symbol in the current font + a no-width breaking space, so as long as you can adjust the width of the return symbol (there are various possible ways to do that) so that Word still wraps at the same points, it may be enough.
Sub markAutoLineBreaks() ' Changes line breaks automatically made by Word ' into "return" charaters, but only where the line ' ends in a " " ' This operates on the text in the current selection ' We use a character style Const strStyleName As String = "contchar" Dim r As Word.Range Dim styContchar As Word.Style ' Add the style if it is not present On Error Resume Next Set styContchar = ActiveDocument.Styles.Add(strStyleName, Type:=WdStyleType.wdStyleTypeCharacter) Err.Clear On Error GoTo 0 ' Set the characteristics of the style. What you need to aim for ' is to adjust the character width so that the text breaks at the ' same point (if possible) Set styContchar = ActiveDocument.Styles(strStyleName) With styContchar.Font .Size = 8 End With ' Save the selection Set r = Selection.Range ' remove old line end marks With Selection.Find .ClearFormatting .Style = styContchar .Replacement.ClearFormatting ' Not sure what to use here, but this will have to do .Replacement.Style = ActiveDocument.Styles("Default Paragraph Font") ' 9166 is the return character. 8204 is a No-width breaking space .Text = ChrW(9166) & ChrW(8204) .Replacement.Text = " " .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Replace:=wdReplaceAll ' Moving down lines is not completely straightforward ' but this seems to work Selection.Collapse direction:=wdCollapseStart Do Until Selection.End > r.End Selection.Bookmarks("\line").Select If Right(Selection, 1) = " " Then Selection.SetRange Selection.End - 1, Selection.End Selection.Delete Selection.Text = ChrW(9166) & ChrW(8204) Selection.Style = styContchar Selection.Bookmarks("\line").Select Selection.Collapse direction:=wdCollapseStart End If Selection.MoveDown wdLine, 1, False Loop ' reselect our original selection r.Select Set r = Nothing End Sub