Jump to content
Sign in to follow this  
Safehaven

Debugged / enhanced UDF Files for Open Office

Recommended Posts

Safehaven

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

  • Like 1

Share this post


Link to post
Share on other sites
AndyG

Hi, i have written some OOCalc-Functions two Years ago. 

An example of the used functions and the collection of these functions is available here: oocalc_4.au3.

Feel free to put anything useful into your UDF!

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
t0nZ

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.

Share this post


Link to post
Share on other sites
Safehaven

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.

Share this post


Link to post
Share on other sites
bob2

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.

Share this post


Link to post
Share on other sites
BrewManNH

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

Share this post


Link to post
Share on other sites
bob2

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

Share this post


Link to post
Share on other sites
gmmg

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.