VBScript format pages

Java, C++, C#, Delphi, ??? - Using the UNO bridges

VBScript format pages

Postby hobbit1 » Wed Feb 03, 2016 1:42 pm

I would like to help to translate the following code in VBScript:

Dim Doc As Object
Dim Sheet As Object
Dim StyleFamilies As Object
Dim PageStyles As Object
Dim DefPage As Object

Doc = ThisComponent
StyleFamilies = Doc.StyleFamilies
PageStyles = StyleFamilies.getByName("PageStyles")
DefPage = PageStyles.getByName("Default")

DefPage.LeftMargin = 1000
DefPage.RightMargin = 1000
OpenOffice 4.1.2 on Windows 7
hobbit1
 
Posts: 2
Joined: Wed Feb 03, 2016 1:33 pm

Re: VBScript format pages

Postby MTP » Wed Feb 03, 2016 5:16 pm

Are you working with a Calc file or a Writer file?

Do you have to use VBScript and not, say, python?

Will the file you want to manipulate already be open, or will the script have to open it?

How will you identify the file you want to manipulate? By file url?
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
User avatar
MTP
Volunteer
 
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: VBScript format pages

Postby hobbit1 » Wed Feb 03, 2016 7:35 pm

I have to write a program in VBScript that manipulate CALC file.
I don't have problems opening the file.
I have problems to pass left margin, right margin, top margin and bottom margin of the page.
OpenOffice 4.1.2 on Windows 7
hobbit1
 
Posts: 2
Joined: Wed Feb 03, 2016 1:33 pm

Re: VBScript format pages

Postby B Marcelly » Wed Feb 03, 2016 9:52 pm

Then it is simply:
Code: Select all   Expand viewCollapse view
' ***** VBScript *****
Dim Doc
Dim Sheet
Dim StyleFamilies
Dim PageStyles
Dim DefPage

' ( you already have Doc )
Set StyleFamilies = Doc.StyleFamilies
Set PageStyles = StyleFamilies.getByName("PageStyles")
Set DefPage = PageStyles.getByName("Default")

DefPage.LeftMargin = 1000
DefPage.RightMargin = 1000
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
B Marcelly
Volunteer
 
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area


Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests