[Solved] Building a macro for inserting section

Creating a macro - Writing a Script - Using the API

[Solved] Building a macro for inserting section

Postby roberto.vieira » Tue Oct 08, 2019 3:36 pm

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
roberto.vieira
 
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Cannot find dll on Win7 64 Bit

Postby Villeroy » Wed Oct 09, 2019 7:06 pm

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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27364
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot find dll on Win7 64 Bit

Postby roberto.vieira » Wed Oct 09, 2019 8:54 pm

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

Postby roberto.vieira » Thu Oct 24, 2019 11:18 pm

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
roberto.vieira
 
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Cannot find dll on Win7 64 Bit

Postby Lupp » Thu Oct 24, 2019 11:32 pm

Please don't hitchhike unrelated threads.

http://www.pitonyak.org/AndrewMacro.pdf 7.25.1
On Windows 10: LibreOffice 6.2 and older versions, PortableOpenOffice 4.1.5 and older, StarOffice 5.2
---
Lupp from München
User avatar
Lupp
Volunteer
 
Posts: 2564
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Cannot find dll on Win7 64 Bit

Postby Villeroy » Thu Oct 24, 2019 11:38 pm

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, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27364
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Cannot find dll on Win7 64 Bit

Postby roberto.vieira » Thu Oct 24, 2019 11:52 pm

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
roberto.vieira
 
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm

Re: Building a macro for inserting section

Postby DiGro » Fri Oct 25, 2019 1:22 pm

Roberto, have a look at this:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Text_Sections

Maybe that will help you further
____________
DiGro

AOO 4.1.7 on Windows 10. Scanned with ZIGGO Safe Online (F-Secure)
User avatar
DiGro
 
Posts: 82
Joined: Mon Oct 08, 2007 1:31 am
Location: Hoorn NH, The Netherlands

Re: Building a macro for inserting section

Postby JeJe » Fri Oct 25, 2019 1:45 pm

Useful Macro Information
For OpenOffice
By
Andrew Pitonyak

Listing 7.57

Code: Select all   Expand viewCollapse view
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
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 624
Joined: Wed Mar 09, 2016 2:40 pm

Re: Building a macro for inserting section

Postby roberto.vieira » Fri Oct 25, 2019 2:58 pm

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
roberto.vieira
 
Posts: 5
Joined: Tue Oct 08, 2019 3:13 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests