[Libreoffice-bugs] [Bug 127042] New: Unable to modify TablecolumnSeparator in Writer using VB OOO

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Tue Aug 20 05:58:25 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=127042

            Bug ID: 127042
           Summary: Unable to modify TablecolumnSeparator in Writer using
                    VB OOO
           Product: LibreOffice
           Version: 6.3.0.4 release
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: didier.laroche at hotmail.com

Description:
Hello,

I am using VBA (from MS Access) to generate writer documnet.

When dealing with tables, i am unable to modify the TableColumnSepartor
property from VB OOO. Same functionality implemented as a Macro in the writer
document is working. (document is attached)

My VB ooo code:
Sub ResizeColumnTable()
Dim oSM                   'Root object for accessing OpenOffice from VB
Dim oDesk, oDoc As Object 'First objects from the API
Dim arg()

    'Instantiate OOo
    Set oSM = CreateObject("com.sun.star.ServiceManager")
    ' Create the first and most important service
    Set oDesk = oSM.CreateInstance("com.sun.star.frame.Desktop")


    ' file must be full access to the file to be uploaded
    Set oDoc =
oDesk.loadComponentFromURL("file:///c:/.../bugColumnSeparator.odt", "_blank",
0, arg())

    ' ++++++++++++++++++++++++++ table management ++++++++++++++
    Dim oRepTables As Object
    Set oRepTables = oDoc.getTextTables

    Dim oTableRep As Object
    Set oTableRep = oRepTables.GetByName("tbl_table1")

    ' modify table column separator
    Dim objColumnSeparator As Object

    objColumnSeparator = oTableRep.GetPropertyValue("TableColumnSeparators")

    objColumnSeparator(0).Position = 1000
    objColumnSeparator(1).Position = 2000
    objColumnSeparator(2).Position = 3000
    objColumnSeparator(2).Position = 4000


    oTableRep.SetPropertyValue "TableColumnSeparators", objColumnSeparator

    'Save the document as a new document
    Call oDoc.storeToURL("file:///c:/...../bugColumnSeparatorUpdated.odt",
arg())

    'Close the document
    oDoc.Close (True)
    Set oDoc = Nothing
End Sub

I have attached the writer document that contains the same functionality
developped as a macro (main)

Steps to Reproduce:
1.run the VB code provided in the description
2.file will not have the column sized modified
3.running macro in the writer document make it work

Actual Results:
table columns are not changed in size

Expected Results:
table column sized changed (same as the main macro in the attached document)


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Sub ResizeColumnTable()
Dim oSM                   'Root object for accessing OpenOffice from VB
Dim oDesk, oDoc As Object 'First objects from the API
Dim arg()

    'Instantiate OOo
    Set oSM = CreateObject("com.sun.star.ServiceManager")
    ' Create the first and most important service
    Set oDesk = oSM.CreateInstance("com.sun.star.frame.Desktop")


    ' file must be full access to the file to be uploaded
    Set oDoc =
oDesk.loadComponentFromURL("file:///c:/.../bugColumnSeparator.odt", "_blank",
0, arg())

    ' ++++++++++++++++++++++++++ table management ++++++++++++++
    Dim oRepTables As Object
    Set oRepTables = oDoc.getTextTables

    Dim oTableRep As Object
    Set oTableRep = oRepTables.GetByName("tbl_table1")

    ' modify table column separator
    Dim objColumnSeparator As Object

    objColumnSeparator = oTableRep.GetPropertyValue("TableColumnSeparators")

    objColumnSeparator(0).Position = 1000
    objColumnSeparator(1).Position = 2000
    objColumnSeparator(2).Position = 3000
    objColumnSeparator(2).Position = 4000


    oTableRep.SetPropertyValue "TableColumnSeparators", objColumnSeparator

    'Save the document as a new document
    Call oDoc.storeToURL("file:///c:/...../bugColumnSeparatorUpdated.odt",
arg())

    'Close the document
    oDoc.Close (True)
    Set oDoc = Nothing
End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190820/ea06b479/attachment-0001.html>


More information about the Libreoffice-bugs mailing list