火曜日, 12月 16, 2008

VBScriptでOpenofficeの操作の例

  1. Portable版のVB制御

    Set oSM = WScript.CreateObject("com.sun.star.ServiceManager")
    'Set oCR = oSM.createInstance("com.sun.star.reflection.CoreReflection")
    Set oDesktop = oSM.createInstance("com.sun.star.frame.Desktop")
    Dim aArgs()

    Set oDoc = oDesktop.loadComponentFromURL("private:factory/scalc","_blank",0,aArgs)

    Set oSelection = oDoc.getCurrentSelection()
    If oSelection.supportsService("com.sun.star.sheet.SheetCell") Then
    Set oCell = oSelection
    ElseIf oSelection.supportsService("com.sun.star.sheet.SheetCellRange") Then
    Set oCell = oSelection.getCellByPosition(0,0)
    Else
    WScript.Quit()
    End If

    oCell.setValue(1000.0)






  2. var shell=new ActiveXObject("WScript.Shell");
    var objServiceManager = new ActiveXObject("com.sun.star.ServiceManager")

    //Create the Desktop
    var objDesktop = objServiceManager.createInstance("com.sun.star.frame.Desktop")

    //Open a new empty writer document
    var args=new Array();

    var objDocument = objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0,args)

    //Create a text object
    var args=new Array();

    //create dispatcher
    var doc=objDocument.CurrentController.Frame

    var dispatcher = objServiceManager.createInstance("com.sun.star.frame.DispatchHelper")

    dispatcher.executeDispatch(doc, ".uno:Paste", "", 0, args)
    dispatcher.executeDispatch(doc, ".uno:GoToStartOfDoc", "", 0, args)
    dispatcher.executeDispatch(doc, ".uno:SpellDialog ", "", 0, args)
    dispatcher.executeDispatch(doc, ".uno:SelectAll", "", 0, args)
    dispatcher.executeDispatch(doc, ".uno:Copy", "", 0, args)

    shell.popup("Text was checked and the corrected version was copied to the clipboard");

    objDocument.close(false)

    Spellcheck Clipboard

  3. Andrew Pitonyak
    1. Document: http://www.pitonyak.org/AndrewMacro.odt
    2. Book: http://www.hentzenwerke.com/catalog/oome.htm
    3. Free Info: http://www.pitonyak.org/oo.php


    The Complete UNO/C++ Document From Welcome to Serge Moutou


    The Complete UNO/C++ Document link
    master document Download
    OOo Master document
    chapter 1 : Introduction Download
    OOo Chapter 1
    chapter 2 : How to install the SDK and compile the C++
    examples
    Download
    OOo Chapter 2
    chapter 3 : The UNO C++ language Download
    OOo Chapter 3
    chapter 4 : OpenOffice.org's UNO/ automation with a
    binary (executable)
    Download
    OOo Chapter 4
    chapter 5 : OpenOffice Calc Download
    OOo Chapter 5
    chapter 6 : OOoDraw/OOoImpress Download
    OOo Chapter 6
    chapter 7 : Shapes Download
    OOo Chapter 7
    chapter 8 : OOoWriter Download
    OOo Chapter 8
    chapter 9 : General Utilities Download
    OOo Chapter 9
    chapter 10 : IDL Files and Cpp Download
    OOo Chapter 10
    chapter 11 : UNO registry and bootstrapping Download
    OOo Chapter 11
    chapter 12 : Constructing Helpers Download
    OOo Chapter 12
    chapter 13 : Constructing components Download
    OOo Chapter 13
    chapter 14 : Addin : adding OooCalc functions Download
    OOo Chapter 14
    chapter 15 The makefile Download
    OOo Chapter 15
    chapter 16 Filters and XML Download
    OOo Chapter 16


  4. Programming OpenOffice.org with Visual Basic

  5. OOoMacros.org
    For Developers



  6. Some Introspection techniques (various languages)

0 件のコメント: