Please peruse this API on EOF.
Is there any API opposite of EOF? Like the Boolean testing of the Beginning Of File? And Going to the BOF? It is very much required! Because I want a second search from the beginning of the file after the first ends at the EOF.
[Solved Elsewhere] Is there any API opposite of EOF?
[Solved Elsewhere] Is there any API opposite of EOF?
Last edited by rajibando on Mon Aug 28, 2017 4:56 am, edited 2 times in total.
LibreOffice 4.0.3.3 (Build ID: 400m0(Build:3)) in Knoppix 7.2.0
Re: Is there any API opposite of EOF?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Is there any API opposite of EOF?
Searched for examples, and read and found these codes here:
The user mohitchugh never visited the forum again, so the case of PMing him or Helmar, who visited only twice, to learn doesn't arise.
How to use them here to bring the pointer/cursor to the beginning of the file before running the following function? :
Code: Select all
uno::Any aRet = cppu::queryInterface( rType,
(static_cast< io::XInputStream* >(this)),
(static_cast< io::XSeekable* >(this)) );
How to use them here to bring the pointer/cursor to the beginning of the file before running the following function? :
Code: Select all
REM Reiteration to remove empty paras after above action
Function Writer_ReplaceAll_Blank_Paras() As Long
Dim bReplace as Object
bReplace = ThisComponent.createReplaceDescriptor()
bReplace.setSearchString( chr(10) + "^$" )
bReplace.setReplaceString( chr(10) )
bReplace.SearchRegularExpression = True
Writer_ReplaceAll_Blank_Paras = ThisComponent.replaceAll( bReplace )
End Function
Last edited by rajibando on Mon Jul 31, 2017 6:32 pm, edited 1 time in total.
LibreOffice 4.0.3.3 (Build ID: 400m0(Build:3)) in Knoppix 7.2.0
Re: Is there any API opposite of EOF?
Input streams are not related to the find and replace functions in macros. The replaceAll() function will, as I understand it, search the entire document without any need to tell it where to start. I do see a problem with your SearchString. I don't see how chr(10) + "^$" can find anything. It represents a linefeed followed by an empty paragraph but a linefeed does not end a paragraph, so what is between the linefeed and the empty paragraph? Do you want to search for a linefeed at the end of a paragraph? That would be "\n$".
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Is there any API opposite of EOF?
Okay, that is great! So I will not have to work on that code that much! Thanks!FJCC wrote: The replaceAll() function will ... search the entire document without any need to tell it where to start
I just wanted to incorporate that pattern, I did not want to involve you as Zizi is handling that post.
The post is here: A Specific Macro with Find-Replace?
...
Okay, please look at the attached file: , you shalll see the need for that particular string "↲¶", where ¶ is the empty paragraph "^$" in my text to be removed.FJCC wrote:... I don't see how chr(10) + "^$" can find anything...
LibreOffice 4.0.3.3 (Build ID: 400m0(Build:3)) in Knoppix 7.2.0
Re: Is there any API opposite of EOF?
Perhaps we are using different terminology but I don't see any empty paragraphs in your document. When I view it with non-printing characters visible, I see a mixture of line feeds (↲) and paragraph marks (¶) and in no case does a line feed come immediately before a paragraph mark.
Do you want to replace all ¶ with ↲? That will convert your document to a single paragraph, which can cause problems because there is a limit to size of a paragraph. Searching for "$" and replacing with CHR(10) will do that.
Do you want to replace all ¶ with ↲? That will convert your document to a single paragraph, which can cause problems because there is a limit to size of a paragraph. Searching for "$" and replacing with CHR(10) will do that.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
Re: Is there any API opposite of EOF?
That one was the perfect file, manually edited.
The two are the initial 'Test' file, and the result of the macro application to output 'Tested' file.
You didn't look at the indicated thread, which Zizi is handling?
This macro is as follows:
and after application of the macro
The two are the initial 'Test' file, and the result of the macro application to output 'Tested' file.
You didn't look at the indicated thread, which Zizi is handling?
This macro is as follows:
Code: Select all
rem *****************************************
Function Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds() As Long
REM Replaces all Paragraph breaks with a Linefeed character within the current Writer document.
REM Returns: the number of found/replaced occurrences.
Dim oReplace as Object
oReplace = ThisComponent.createReplaceDescriptor()
oReplace.setSearchString( "[a-z,A-Z,0-9]$" )
oReplace.setReplaceString( "&" + chr(10) )
oReplace.SearchRegularExpression = True
Writer_ReplaceAll_Paragraph_Breaks_With_Linefeeds = ThisComponent.replaceAll( oReplace )
End Function
LibreOffice 4.0.3.3 (Build ID: 400m0(Build:3)) in Knoppix 7.2.0