https://bugs.documentfoundation.org/show_bug.cgi?id=148025
--- Comment #6 from flywire <[email protected]> --- Two issues with pdf: 1. Leading spaces lost UNLESS caption in selection 2. Extra blank line above MsgBox Demonstration ============= The functionality depends on the pdf viewer used. 1a. Using XpdfReader Version 4.03 www.xpdfreader.com * Open https://www.pitonyak.org/OOME_3_0.pdf#page=88 * Copy/Paste Listing to a text editor: Listing 59. Modified bubble sort. Sub ExampleForNextSort Dim iEntry(10) As Integer Dim iOuter As Integer, iInner As Integer, iTemp As Integer Dim bSomethingChanged As Boolean ' Fill the array with integers between -10 and 10 For iOuter = LBound(iEntry()) To Ubound(iEntry()) iEntry(iOuter) = Int((20 * Rnd) -10) Next iOuter ' iOuter runs from the highest item to the lowest For iOuter = UBound(iEntry()) To LBound(iEntry()) Step -1 'Assume that the array is already sorted and see if this is incorrect bSomethingChanged = False For iInner = LBound(iEntry()) To iOuter-1 If iEntry(iInner) > iEntry(iInner+1) Then iTemp = iEntry(iInner) iEntry(iInner) = iEntry(iInner+1) iEntry(iInner+1) = iTemp bSomethingChanged = True End If Next iInner 'If the array is already sorted then stop looping! If Not bSomethingChanged Then Exit For Next iOuter Dim s$ For iOuter = LBound(iEntry()) To Ubound(iEntry()) s = s & iOuter & " : " & iEntry(iOuter) & CHR$(10) Next iOuter MsgBox s, 0, "Sorted Array" End Sub 1b. Repeat in Acrobat, Brave, SumatraPDF etc: Listing 59. Modified bubble sort. Sub ExampleForNextSort Dim iEntry(10) As Integer Dim iOuter As Integer, iInner As Integer, iTemp As Integer Dim bSomethingChanged As Boolean ' Fill the array with integers between -10 and 10 For iOuter = LBound(iEntry()) To Ubound(iEntry()) iEntry(iOuter) = Int((20 * Rnd) -10) Next iOuter ' iOuter runs from the highest item to the lowest For iOuter = UBound(iEntry()) To LBound(iEntry()) Step -1 'Assume that the array is already sorted and see if this is incorrect bSomethingChanged = False For iInner = LBound(iEntry()) To iOuter-1 If iEntry(iInner) > iEntry(iInner+1) Then iTemp = iEntry(iInner) iEntry(iInner) = iEntry(iInner+1) iEntry(iInner+1) = iTemp bSomethingChanged = True End If Next iInner 'If the array is already sorted then stop looping! If Not bSomethingChanged Then Exit For Next iOuter Dim s$ For iOuter = LBound(iEntry()) To Ubound(iEntry()) s = s & iOuter & " : " & iEntry(iOuter) & CHR$(10) Next iOuter MsgBox s, 0, "Sorted Array" End Sub 2a. Another example using XpdfReader to open https://documentation.libreoffice.org/assets/Uploads/Documentation/en/GS7.3/GS73-GettingStarted.pdf#page=425 Sub AppendHello Dim oDoc Dim sTextService$ Dim oCurs REM ThisComponent refers to the currently active document. oDoc = ThisComponent REM Verify that this is a text document. sTextService = "com.sun.star.text.TextDocument" If NOT oDoc.supportsService(sTextService) Then MsgBox "This macro only works with a text document" Exit Sub End If REM Get the view cursor from the current controller. oCurs = oDoc.currentController.getViewCursor() REM Move the cursor to the end of the document. oCurs.gotoEnd(False) REM Insert text "Hello" at the end of the document. oCurs.Text.insertString(oCurs, "Hello", False) End Sub 2b. Let's try again including the Listing Caption: Listing 5: Append the text “Hello” at the end of to the current document Sub AppendHello Dim oDoc Dim sTextService$ Dim oCurs REM ThisComponent refers to the currently active document. oDoc = ThisComponent REM Verify that this is a text document. sTextService = "com.sun.star.text.TextDocument" If NOT oDoc.supportsService(sTextService) Then MsgBox "This macro only works with a text document" Exit Sub End If REM Get the view cursor from the current controller. oCurs = oDoc.currentController.getViewCursor() REM Move the cursor to the end of the document. oCurs.gotoEnd(False) REM Insert text "Hello" at the end of the document. oCurs.Text.insertString(oCurs, "Hello", False) End Sub -- You are receiving this mail because: You are the assignee for the bug.
