[Solved] Building a macro for inserting section

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
roberto.vieira
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

[Solved] Building a macro for inserting section

Post by roberto.vieira »

I think I fall in almost the same case as merbeth.

I´m replacing MS Office by Libre Office in an VB.Net (VS 2010) desktop application.

Running the writerdemo, I could run the application.

Now, when I replaced code calling to Writer instead of MS Word, the application the executes the word processor is not compiled. I get no error messages, but I get one warning that says "There was a mismatch between the processor architecture of the project being built "x86" and the processor architecture of the reference "cli_cppuhelper", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project."

I already built as x86 and as x64, but I get no compilation of the application. To me, seems like the dll´s were built with AMD64 architeture. I tried also naming as "AMD64", but no solution.

Can you give me some help ?

Roberto Camargo / Rio de Janeiro
Last edited by Hagar Delest on Fri Oct 25, 2019 4:42 pm, edited 1 time in total.
Reason: tagged solved.
LibreOffice 6.3.1.2 / Windows 7
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot find dll on Win7 64 Bit

Post by Villeroy »

Install the 64-bit variant of LibreOffice for Windows.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
roberto.vieira
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Cannot find dll on Win7 64 Bit

Post by roberto.vieira »

About the previous thread I wrote, it was resolved after installing the most recente dayly compile.

Villeroy, thanks, I´m already using x64 version.

After this, I got that application compiled.

Thanks,
Roberto Camargo.
LibreOffice 6.3.1.2 / Windows 7
roberto.vieira
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Building a macro for inserting section

Post by roberto.vieira »

Dears,

I looked all over the history, and other papers, and I didn´t find any example of how to insert section in a document.

I´m working a code for replacing the msword by libre, and there exist two sections that I insert.

I´m doing it with VB.Net, but giving me some idea how doing this as a Basic macro, will be of a great help.

Using the Object Inspector, I opened the branch "XTextSectionsSupplier", hoping to find there something sounding as the way to resolve this, but I couldn´t.

Could you be kind helping me to resolve this ?

In advance, my best thanks,
Roberto Vieira.
Last edited by roberto.vieira on Thu Oct 24, 2019 11:40 pm, edited 1 time in total.
LibreOffice 6.3.1.2 / Windows 7
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Cannot find dll on Win7 64 Bit

Post by Lupp »

Please don't hitchhike unrelated threads.

http://www.pitonyak.org/AndrewMacro.pdf 7.25.1
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot find dll on Win7 64 Bit

Post by Villeroy »

Keep your MS Office solution for ever.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
roberto.vieira
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Cannot find dll on Win7 64 Bit

Post by roberto.vieira »

Thx, Lupp, for your repply.

Beside others, and searching over all, I read many times the indicated paper, and, as I told, I could´nt arrive to a solution. But, it was there that I found the XTextSectionsSupplier service. Starting from this, I looked at the Object Inspector, hoping to find some method to insert.

I know that many ways the codes are implemented at OO Basic is very different than VB. And, yet coming since DOS 3.2, with OO Basic I´m very new.
LibreOffice 6.3.1.2 / Windows 7
User avatar
DiGro
Posts: 173
Joined: Mon Oct 08, 2007 1:31 am
Location: Hoorn NH, The Netherlands

Re: Building a macro for inserting section

Post by DiGro »

Roberto, have a look at this:

https://wiki.openoffice.org/wiki/Docume ... t_Sections

Maybe that will help you further
____________
DiGro

AOO 4.1.15 (Dutch) on Windows 11. Scanned with Ziggo Safe Online (F-Secure)
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Building a macro for inserting section

Post by JeJe »

Useful Macro Information
For OpenOffice
By
Andrew Pitonyak

Listing 7.57

Code: Select all

Sub AddTextSection
Dim oSect
Dim sName$
Dim oVC
Dim oText
Dim oCols
Dim s$
sName = "ADPSection"
If ThisComponent.getTextSections().hasByName(sName) Then
Print "Text section " & sName & " Already exists"
oSect = ThisComponent.getTextSections().getByName(sName)
Else
REM Create a text section at the cursor
oVC = ThisComponent.getCurrentController().getViewCursor()
oText = oVC.getText()
REM Insert a new paragraph
oText.insertControlCharacter(oVC, _
com.sun.star.text.ControlCharacter.LINE_BREAK, False)
REM Insert a new paragraph and select it
oText.insertControlCharacter(oVC, _
com.sun.star.text.ControlCharacter.LINE_BREAK, True)
s = "com.sun.star.text.TextSection"
oSect = ThisComponent.createInstance(s)
oSect.setName(sName)
REM Now, create the columns...
s = "com.sun.star.text.TextColumns"
oCols = ThisComponent.createInstance(s)
oCols.setColumnCount(2)
oSect.TextColumns = oCols
187
oText.insertTextContent(oVC, oSect, True)
oText.insertString(oVC, "This is new text. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"I suppose that I could count and repeat myself as " & _
"an example of how text can go on and on and on. " & _
"And finally I will stop.", True)
Print "Created the text section"
End If
oCols = oSect.TextColumns
Dim OC()
OC() = oCols.getColumns()
REM Set the right margin on the first column to 1/4 inch.
OC(0).RightMargin = 635
REM Set the left margin on the second column to 1/4 inch.
OC(1).LeftMargin = 635
oCols.setColumns(OC())
oSect.TextColumns = oCols
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
roberto.vieira
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Building a macro for inserting section

Post by roberto.vieira »

Thanks a lot, Jeje, it looks like going to the point, I will adapt to my needs.

Have a nice day !
LibreOffice 6.3.1.2 / Windows 7
Post Reply