Jump to content

Debugged / enhanced UDF Files for Open Office


Safehaven
 Share

Recommended Posts

Hi Everyone,

I recently started using AutoIt for some development project and I've found & enhanced the OOoCOM_UDF.au3 file to work in a way that is compatible with the standard excel library.

modified entries include:

_OOoCalc_SheetList

_OOoCalc_SheetActivate

_OOoCalc_ReadCell

_OOoCalc_WriteCell

UsedRange

The listed functions are now interchangeable between Microsoft Office (Excel) and Open Office (Calc). I've also improved the working of these functions to call the "correct" API's.

In my search I've found that the OpenOffice site: http://api.openoffice.org/ was very useful.

Please report back with your findings.

All the best,

OOoCOM_UDF_v08.au3

Link to comment
Share on other sites

I recently started using AutoIt for some development project and I've found & enhanced the OOoCOM_UDF.au3 file to work in a way that is compatible with the standard excel library.

modified entries include:

_OOoCalc_SheetList

_OOoCalc_SheetActivate

_OOoCalc_ReadCell

_OOoCalc_WriteCell

UsedRange

I see a lot of comments like this:
Func _OOoCalc_Attach($fn)
    Dim $oSM
    Local $oDesktop, $f_num
    $oSM = ObjCreate("com.sun.star.ServiceManager")
    $oDesktop = $oSM.createInstance("com.sun.star.frame.Desktop") ; Create a desktop object:
    ; êîë-âî îêîí, íå ïîäõîäèò òîëüêî äëÿ öèêëà ïåðåáîðà îêîí: íå îòñëåæèâàåòñÿ Extension Manager:
    $f_num = $oDesktop.Frames.Count ; number of frames opened for documents or developing
    ;  If few documents are open
    If $f_num > 1 Then ; åñëè íåñêîëüêî îêîí – ñäåëàåì àêòèâíûì íóæíîå

Are you working in an alternate encoding/code page or something?

:blink:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • 3 weeks later...

Hi , I have used the OOoCom_udf.au3 for some months with few problems.

Now I was writing a program to transform "any" calc sheet in a sqlLite table.

It can get a sheet where records are rows and it takes the columns of first row as field names in sqlLite

The program is nearly finished, but i have to "tag" the end of the first row with a particular value, or

_OOoCalc_ReadCell goes in error

First problem.

So I downloaded your UDF, but I have another error: I receive this error (in the UDF) :

C:\Program Files (x86)\AutoIt3\Include\OOoCOM_UDF.au3 (234) : ==> The requested action with this object has failed.:

$SheetComponent = $Sheets.GetByName($Worksheet)

$SheetComponent = $Sheets.GetByName($Worksheet)^ ERROR

This when I use _OOoCalc_ReadCell.

Code:

$oCurCom = _OOoCalc_Open($FFile)

    While 1 ; cycle for column names --> database table names
    
        $tmpcolumn = _OOoCalc_ReadCell($oCurCom, 0, $row, $column) ; first lap for column names of database table

Why ?

By the way thanx to all the contributors of this OpenOffice UDF.

Link to comment
Share on other sites

  • 3 months later...

I see a lot of comments like this:

Func _OOoCalc_Attach($fn)
    Dim $oSM
    Local $oDesktop, $f_num
    $oSM = ObjCreate("com.sun.star.ServiceManager")
    $oDesktop = $oSM.createInstance("com.sun.star.frame.Desktop") ; Create a desktop object:
    ; êîë-âî îêîí, íå ïîäõîäèò òîëüêî äëÿ öèêëà ïåðåáîðà îêîí: íå îòñëåæèâàåòñÿ Extension Manager:
    $f_num = $oDesktop.Frames.Count ; number of frames opened for documents or developing
    ;  If few documents are open
    If $f_num > 1 Then ; åñëè íåñêîëüêî îêîí – ñäåëàåì àêòèâíûì íóæíîå

Are you working in an alternate encoding/code page or something?

:x

I've noticed this as well, luckily this is only the case for the comments, which leads me to believe the original author of the UDF was working with a different signs than the "std" ascii set.

Link to comment
Share on other sites

  • 10 months later...

Hi, I found the functions of ooocalc_4.au3 very interesting, but I have a problem to open a file with: _OOOpenBook ($ fname):

$ fname = @ ScriptDir & "\ Temp1.ods"

_OOOpenBook ($ Fname)

This gives me an error:

==> Missing right bracket ')' in expression.:

$ = $ odoc oDesk.loadComponentFromURL ($ fname, "_blank", 0, $ OpenPar)

$ = ^ ERROR odoc

Can anyone give me an example of use?

In advance, thank you.

Link to comment
Share on other sites

If what you posted is part of your real script, you have a space after every $ and before the variable name, that is not going to work right.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you, but no, I have no space after (that is making a copy and paste into the Google translator as spaces began) :

The requested action with this object has failed.:

$oCurCom = $oDesktop.loadComponentFromURL( $cURL, "_blank", 0, $OpenPar)

$oCurCom = $oDesktop.loadComponentFromURL( $cURL, "_blank", 0, $OpenPar)^ ERROR

Link to comment
Share on other sites

  • 4 months later...

Hello,

I used this OOoCOM_UDF today :oops:

Here is my Solution to delete a sheet by name!

_OOBookDeleteSheet("Tabelle1")
;_OOBookDeleteSheet("sheet1")

Func _OOBookDeleteSheet($sheetname) ;Delete other Sheets  (by default Sheet2,Sheet3)
    $errormodul = "_OODeleteSheet"
    If $odoc.Sheets.hasByName($sheetname) Then $odoc.Sheets.removeByName($sheetname)
EndFunc   ;==>_OOBookDeleteSheet

gmmg

Edited by gmmg
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...