Search code examples
ms-officelibreofficephpwordopenoffice-writerlibreoffice-basic

Last line of text cut off when viewing MS Word documents


I am facing last line cut-off issue in when I created a file in Libre Office, but when I open it in word 2013 or 2016 last line content are cut-off in between.

You can understand the problem in more detail.

http://blog.submittable.com/2015/04/last-line-of-text-cut-off-when-viewing-ms-word-documents/

I have search a lot on web for solution but I did not find anything. Is there any automated way (macros/any add on) by which I can add 3-4 empty enter at the end of file.


Solution

  • The following Basic code is cobbled together from Andrew Pitonyak's Macro document, especially section 5.17.1.

    Sub AddParagraphBreaks
        Dim oCursor As Object
        Dim oText As Object
        Dim iBRKConst As Long
        Dim i As Integer
        oText = ThisComponent.Text
        oCursor = oText.createTextCursor()
        oCursor.gotoEnd(False)
        iBRKConst = com.sun.star.text.ControlCharacter.PARAGRAPH_BREAK
        For i = 1 to 3
            oText.insertControlCharacter(oCursor, iBRKConst, False)
        Next i
    End Sub