Jump to content



Photo

Debugged / enhanced UDF Files for Open Office


  • Please log in to reply
9 replies to this topic

#1 Safehaven

Safehaven

    Seeker

  • Active Members
  • 7 posts

Posted 10 August 2010 - 08:06 AM

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,

Attached Files









#2 AndyG

AndyG

    Prodigy

  • Active Members
  • PipPipPip
  • 189 posts

Posted 10 August 2010 - 08:37 AM

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: Attached File  oocalc_4.au3   19.69KB   628 downloads.

Feel free to put anything useful into your UDF!

#3 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 10 August 2010 - 06:46 PM

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, 10 August 2010 - 06:48 PM.

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

#4 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,409 posts

Posted 14 August 2010 - 11:03 AM

I think this should be in Examples section.
Some moderator can move it there if you ask for it...

#5 t0nZ

t0nZ

    Wayfarer

  • Active Members
  • Pip
  • 50 posts

Posted 29 August 2010 - 02:27 PM

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.

#6 Safehaven

Safehaven

    Seeker

  • Active Members
  • 7 posts

Posted 09 December 2010 - 10:38 AM

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.

#7 bob2

bob2

    Seeker

  • New Members
  • 2 posts

Posted 29 October 2011 - 12:16 PM

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.

#8 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 7,068 posts

Posted 29 October 2011 - 08:51 PM

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.

How to ask questions the smart way!

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#9 bob2

bob2

    Seeker

  • New Members
  • 2 posts

Posted 29 October 2011 - 11:37 PM

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

#10 gmmg

gmmg

    Seeker

  • Active Members
  • 9 posts

Posted 21 March 2012 - 09:17 AM

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, 21 March 2012 - 09:27 AM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users