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

            Bug ID: 96889
           Summary: getPrintAreas generates [automation bridge] exception
           Product: LibreOffice
           Version: Inherited From OOo
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 121715
  --> https://bugs.documentfoundation.org/attachment.cgi?id=121715&action=edit
VBScript test

[automation bridge] [UNO]

The attached VBScript test replicates the unexpected exception

The exception is generated programming LibreOffice by COM Automation.

The array of struct CellRangeAddress reported by getPrintAreas() method is
unusable. If you try to refer a property (e.g. EndRow) an [automation bridge]
exception is generated.

The problem originated in OpenOffice v3.3.0 and has been fixed since AOO
v3.4.1.

Option explicit

'
'    LINE 37 [automation bridge] produces unexpected result
'
call TestGetPrintArea

Sub TestGetPrintArea
    dim SM,CR, Dsk, args(), doc, sheets, sheet0, sheet1, NewAreas(0), areas

    Set SM     = WScript.CreateObject("com.sun.star.ServiceManager")
    Set CR     = SM.createInstance("com.sun.star.reflection.CoreReflection")
    Set Dsk = SM.createInstance("com.sun.star.frame.Desktop")

    Set doc = Dsk.loadComponentFromURL("private:factory/scalc", "_blank", 0,
args)
    set sheets = doc.getSheets()
    call sheets.insertNewByName("Sheet 2", 0)

    set sheet0 = sheets.getByIndex(0)
    set NewAreas(0) =
SM.Bridge_GetStruct("com.sun.star.table.CellRangeAddress")
    NewAreas(0).Sheet = 0
    NewAreas(0).StartRow = 0
    NewAreas(0).StartColumn = 0
    NewAreas(0).EndRow = 9
    NewAreas(0).EndColumn = 1
    msgbox "Created RangeAddress [A1:B10]",, "Step 1/4"

    sheet0.setPrintAreas(NewAreas)
    msgbox "Set PrintArea for sheet [" & sheet0.getName() & "]",, "Step 2/4"

    areas = sheet0.getPrintAreas()
    set sheet1 = sheets.getByIndex(1)
    msgbox "Got object sheet1 [" & sheet1.getName() & "]",, "Step 3/4"

    call sheet1.setPrintAreas(areas)
    msgbox "Copied PrintArea from sheet [" & sheet0.getName() & "] to sheet ["
& sheet1.getName() & "]",, "Step 4/4"
    msgbox "Test completed successfully!",, "DONE"
end sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to