Hi Kirk,
  Just found your post to the SUG  again whilst looking for
something else.
Quick question - did you mange to get anywhere?
Kind regards,
Huw
···
On 10/03/2019 16:02, Huw Pearce
[sailwave] wrote:
Hi Kirk,
That would be fantastic if you are able to provide Jonwith a solution to interface to LibreOffice. What would be
even better if it then would work when Sailwave run under
WINE on Linux & MacOS.
Look forward to seeing what you come up with.
Kind regards,
Huw
          On 10/03/2019 15:27, Kirk
Robertson [sailwave] wrote:
beat me to it. will see what I can find
On Sun, Mar 10, 2019at 11:32 AM Jon Eskdale jon@sailwave.com
[sailwave] <sailwave@yahoogroups.com >
wrote:
Hi Kirk,
If you can supply a Com automationdocumentation that works similar to
the Excel which allows Sailwave to
read and write cells of the
spreadsheet individually and as a
range plus enable/disable auto
calculation and perform calculation
Below is the class which I'vedeveloped for allowing me to
communicate with Excel. If you can
supply documentation to allow me to do
the same with Libre office I will see
what I can do.
Jon
’ http://msdn.microsoft.com/en-us/library/bb978779(v=office.12).aspx
’
’ All functions
'http://office.microsoft.com/en-us/excel-help/excel-functions-by-category-HP005204211.aspx?redir=0
CLASS CXL
INSTANCE m_FileName ASSTRING
INSTANCE m_oExcelApp ASExcel_Application
INSTANCE m_oExcelWorkbook ASExcel_Workbook
INSTANCE m_vExcelWorkbook ASVARIANT
INSTANCE m_oExcelWorkSheet ASExcel_WorkSheet
INSTANCE m_vExcelWorkSheet ASVARIANT
INSTANCE vFalse ASVARIANT
INSTANCE vTrue ASVARIANT
'INSTANCEXl
instance XlEvents asAppEvents
INTERFACE IXL : INHERITIAUTOMATION
PROPERTY GET XLFile() ASSTRING : PROPERTY = m_FileName :
END PROPERTY
PROPERTY SET XLFile( BYVALsFileName AS STRING) : m_FileName =
sFileName : END PROPERTY
METHOD Init()
vFalse = 0
vTrue = 1
’ Open an instance of EXCEL
m_oExcelApp = ANYCOM$PROGID_Excel_Application
' Could EXCEL be opened? Ifnot, terminate this app
IF ISFALSEISOBJECT(m_oExcelApp) OR ERR THEN
outputdebugstring"Error " & Str$(ERR) & " "
& $PROGID_Excel_Application
MSGBOX "Excel could notbe opened. Please check that Excel
and VBA are installed.",“SWHelper -
Error”
EXIT METHOD
ELSE
OBJECT LETm_oExcelApp…Visible = vTrue
END IF
'Create the Events handler interface
XlEvents= CLASS “Class_AppEvents”
IFISFALSE(ISOBJECT(XlEvents)) THEN
msgbox("Errorcreating the event interface.")
ENDIF
'Attach the Events handler interface
to the Agent Control
EVENTSFROM m_oExcelApp CALL XlEvents
END METHOD
METHOD Unload()
SET m_oExcelApp =NOTHING
SET m_oExcelWorkbook =NOTHING
SET m_oExcelWorkSheet =NOTHING
setXlEvents
= nothing
END METHOD
’ Open file
METHOD OPEN(FileN AS STRING)
LOCAL vInFile AS VARIANT
vInFile = FileN
OBJECT CALLm_oExcelApp.WorkBooks.Open(Filename
= vInFile, UpdateLinks=vFalse) TO
m_vExcelWorkbook
SET m_oExcelWorkbook =m_vExcelWorkbook
END METHOD
’ Close File
METHOD CLOSE(FileN AS STRING)
IF FileN = “” THEN
try
OBJECTCALL
m_oExcelWorkbook.Close(SaveChanges=vFalse)
catch
outputdebugstring“Close XL in Class failed probably
because someone manually closed it”
endtry
END IF
END METHOD
’ Select WorkSheet
METHOD SelectWS(WorkSheet ASSTRING)
LOCAL vInSheet AS VARIANT
vInSheet = WorkSheet
OBJECT CALLm_oExcelApp.Sheets(vInSheet).SELECT
OBJECT GETm_oExcelApp.ActiveSheet TO
m_vExcelWorkSheet
SET m_oExcelWorkSheet =m_vExcelWorkSheet
END METHOD
’ Get used Cells to array
METHOD GetUsed()
LOCAL lbrow ASLONG
LOCAL ubrow ASLONG
LOCAL lbcol ASLONG
LOCAL ubcol ASLONG
LOCAL lrow ASLONG
LOCAL lcol ASLONG
LOCAL lvType ASLONG
LOCAL vNoParenArray ASVARIANT
DIM vTwoDimArray(0) AS
VARIANT
localw as
wstring
OBJECT GETm_oExcelWorkSheet.UsedRange.Value TO
vNoParenArray
LET vTwoDimArray() =vNoParenArray
lbrow =LBOUND(vTwoDimArray(),1)
ubrow =UBOUND(vTwoDimArray(),1)
lbcol =LBOUND(vTwoDimArray(),2)
ubcol =UBOUND(vTwoDimArray(),2)
REDIM sArray(lbrow TOubrow, lbcol TO ubcol)
FOR lrow = lbrow TO ubrow
FOR lcol = lbcol TOubcol
lvType =VARIANTVT(vTwoDimArray(lrow,lcol))
IF lvType = 0 ORlvType = 1 THEN ’ nothing or null
ELSEIF lvType = 8THEN 'string
w= variant$$(vTwoDimArray(lrow,lcol))
'outputdebugstring"variant " + w
sArray(lrow,lcol)= w
ELSEIF lvType => 2AND lvType <= 6 THEN
sArray(lrow,lcol)=
FORMAT$(VARIANT#(vTwoDimArray(lrow,lcol)))
ELSE
sArray(lrow,lcol)= “unknown”
END IF
NEXT
NEXT
END METHOD
methodStoreRange(Param1 as string, Param2
as string)
dimvArray as
variant
dimvParam1 as
Variant
dimvParam2 as
variant
vParam1= Param1
vParam2= Param2
vArray= sInArray()
objectlet
m_oExcelWorkSheet.Cells.Range(vParam1,
vParam2) = vArray
END METHOD
methodStoreValue(c as string, value as
String)
localvCell as
variant
localvValue as
Variant
vCell= c
vValue= value
objectlet
m_oExcelWorkSheet.Range(vCell).value
= vValue
END METHOD
methodReadString(c as string) as string
localvCell as
variant
localvValue as
Variant
localw as
wstring
vCell= c
objectget
m_oExcelWorkSheet.Range(vCell).value
to vValue
w= Variant$$(vValue)
method= w
END METHOD
methodReadNumeric(c as string) as double
localvCell as
variant
localvValue as
Variant
localw as
wstring
vCell= c
objectget
m_oExcelWorkSheet.Range(vCell).value
to vValue
method= Variant#(vValue)
END METHOD
methodScreenUpdating(b as long)
localv as Variant
v= b
objectlet m_oExcelApp.ScreenUpdating = v
END METHOD
methodEnableCalculation(b as long)
localv as Variant
v= b
objectlet
m_oExcelWorkSheet.EnableCalculation
= v
END METHOD
'Set Calcultion mode can be
xlCalculationManual,
xlCalculationAutomatic or
xlCalculationSemi
methodSetCalculationMode(b as long)
localv as Variant
v= b
objectlet m_oExcelApp.Calculation = v
END METHOD
MethodGetCalculationState() as long
LocalvValue as
variant
objectGet m_oExcelApp.CalculationState to
vValue
Method= VARIANT#(vValue)
END METHOD
METHODCalcNow()
Objectcall m_oExcelApp.Calculate()
END METHOD
METHODCalcWSNow()
Objectcall m_oExcelWorkSheet.Calculate()
END METHOD
END INTERFACE
END CLASS
JonEskdale
03333 443377
07530 112233
On Sun,10 Mar 2019 at 15:10, Kirk Robertson jkirkrobertson@gmail.com
[sailwave] <sailwave@yahoogroups.com >
wrote:
I knowyou are all pretty busy
right and am not begging.
But hasany thought been given to
supporting Libre Office as
alternative to Microsoft.
Mustadmit I like Libre Office so
much, I have donated to
project (not that my
donation(s) amounts to “a
hill of beans”).
Would beneat to have interface to
its spreadsheet
Sent from
for Windows 10
** From:** Huw
Pearce
huw.pearce@bcs.org.uk
[sailwave]
Sent: Sunday,
March 10, 2019 11:05 AM
To: sailwave@yahoogroups.com
Subject: Re:
[sailwave] sailwave and
Libre Office
Hi Kirk,
In what way do youwant to Sailwave to to
be used with
LibreOffice? I have
successfully published
to LibreOffice Writer
& LibreOffice
Calc. However if you
mean using LibreOffice
Calc as an alternative
to Microsoft Excel for
external RYA NHC use
then the answer is no.
Sailwave uses
Microsoft messaging
API’s to communicate
with Excel which do
not work with
LibreOffice which has
a different API.
PS - I see Jon hasalready replied
Kind regards,
Huw
On10/03/2019 14:27, kirkrobertson406@yahoo.com
[sailwave] wrote:
Has anyonesuccessfully used
Sailwave with
Libre Office
instead of
Microsoft Office
Virus-free.
