sailwave and Libre Office

Has anyone successfully used Sailwave with Libre Office instead of Microsoft Office

Hi Kirk,

What function are you trying to use Libre Office? If you are just trying to publish to one of these I see no reason why it wouldn’t work

However, If it is for NHC in external mode then probably it won’t work because the NHC external mode automates Excel using the Com automation which will be different.

Additionally, it specifically starts Excel.

Jon

···

Jon Eskdale

03333 443377

07530 112233

Of course, it was NHC external mode. Just checking- no problem

···

Sent from Mail for Windows 10

From: Jon Eskdale jon@sailwave.com [sailwave]
Sent: Sunday, March 10, 2019 10:58 AM
To: sailwave@yahoogroups.com
Subject: Re: [sailwave] sailwave and Libre Office

https://mailtrack.io/trace/mail/648aab6e070ab7c83ee7121c8ec03d6d034d6645.png?u=2430811

Hi Kirk,

What function are you trying to use Libre Office? If you are just trying to publish to one of these I see no reason why it wouldn’t work

However, If it is for NHC in external mode then probably it won’t work because the NHC external mode automates Excel using the Com automation which will be different.

Additionally, it specifically starts Excel.

Jon

Jon Eskdale

https://docs.google.com/uc?export=download&id=0B-EBPMF3upDrZE5wOWRzZTdVZmM&revid=0B-EBPMF3upDrRzBzL1dXUFBuVFlGVGJoeVhXdFhodGRUbjZBPQ

03333 443377

07530 112233

On Sun, 10 Mar 2019 at 14:52, kirkrobertson406@yahoo.com [sailwave] sailwave@yahoogroups.com wrote:

Has anyone successfully used Sailwave with Libre Office instead of Microsoft Office

Hi Kirk,

  In what way do you want 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 has already replied

Kind regards,

Huw

···

On 10/03/2019 14:27,
[sailwave] wrote:

kirkrobertson406@yahoo.com

          Has anyone successfully used Sailwave with Libre Office

instead of Microsoft Office


Virus-free. www.avast.com

I know you are all pretty busy right and am not begging.

But has any thought been given to supporting Libre Office as alternative to Microsoft.

Must admit I like Libre Office so much, I have donated to project (not that my donation(s) amounts to “a hill of beans”).

Would be neat to have interface to its spreadsheet

···

Sent from Mail 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 you want 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 has already replied

Kind regards,

Huw

On 10/03/2019 14:27, kirkrobertson406@yahoo.com [sailwave] wrote:

Has anyone successfully used Sailwave with Libre Office instead of Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

Virus-free. www.avast.com

Hi Kirk,

  I agree having an interface to LibreOffice as well would be nice.

But I know that is a lot of work for the single developer, who is
also a good friend, and will involve him learning a whole new
programming interface when all his development experience has been
with Microsoft environment.

  So unfortunately I do not expect Sailwave LibreOffice Calc to be

implemented.

  Out of interest is your wish for using Sailwave on a Microsoft

Windows?

Kind regards,

Huw

···

On 10/03/2019 15:04, Kirk Robertson
[sailwave] wrote:

jkirkrobertson@gmail.com

            I know you are all pretty busy right

and am not begging.

            But has any thought been given to

supporting Libre Office as alternative to Microsoft.

            Must admit I like Libre Office so

much, I have donated to project (not that my donation(s)
amounts to “a hill of beans”).

            Would be neat to have interface to

its spreadsheet

Sent from Mail 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 you want 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 has already replied

Kind regards,

Huw

On 10/03/2019 14:27, kirkrobertson406@yahoo.com
[sailwave] wrote:

                      Has anyone successfully used Sailwave with

Libre Office instead of Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

                              Virus-free.

www.avast.com

for me personally, I would never use Microsoft office again.

I bought a real license once; it was not accepted when I upgraded my computer (a year later) and now they want to rent it to you.

(I do use Visual Studio, so I am not a complete anti -Microsofter).

Would be willing to look into coms interface between the two

···

On Sun, Mar 10, 2019 at 11:20 AM Huw Pearce huw.pearce@bcs.org.uk [sailwave] sailwave@yahoogroups.com wrote:

Hi Kirk,

  I agree having an interface to LibreOffice as well would be nice.

But I know that is a lot of work for the single developer, who is
also a good friend, and will involve him learning a whole new
programming interface when all his development experience has been
with Microsoft environment.

  So unfortunately I do not expect Sailwave LibreOffice Calc to be

implemented.

  Out of interest is your wish for using Sailwave on a Microsoft

Windows?

Kind regards,

Huw

  On 10/03/2019 15:04, Kirk Robertson > jkirkrobertson@gmail.com [sailwave] wrote:
            I know you are all pretty busy right

and am not begging.

            But has any thought been given to

supporting Libre Office as alternative to Microsoft.

            Must admit I like Libre Office so

much, I have donated to project (not that my donation(s)
amounts to “a hill of beans”).

            Would be neat to have interface to

its spreadsheet

Sent from Mail 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 you want 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 has already replied

Kind regards,

Huw

On 10/03/2019 14:27, kirkrobertson406@yahoo.com > > [sailwave] wrote:

                      Has anyone successfully used Sailwave with

Libre Office instead of Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

                              Virus-free.

www.avast.com

Hi Kirk,

If you can supply a Com automation documentation 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’ve developed 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 AS STRING

INSTANCE m_oExcelApp AS Excel_Application

INSTANCE m_oExcelWorkbook AS Excel_Workbook

INSTANCE m_vExcelWorkbook AS VARIANT

INSTANCE m_oExcelWorkSheet AS Excel_WorkSheet

INSTANCE m_vExcelWorkSheet AS VARIANT

INSTANCE vFalse AS VARIANT

INSTANCE vTrue AS VARIANT

'INSTANCE Xl

instance	XlEvents				as AppEvents

INTERFACE IXL : INHERIT IAUTOMATION

PROPERTY GET XLFile() AS STRING : PROPERTY = m_FileName : END PROPERTY

PROPERTY SET XLFile( BYVAL sFileName 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? If not, terminate this app

IF ISFALSE ISOBJECT(m_oExcelApp) OR ERR THEN

		outputdebugstring "Error  " & Str$(ERR) & " " & $PROGID_Excel_Application

MSGBOX “Excel could not be opened. Please check that Excel and VBA are installed.”,“SWHelper - Error”

EXIT METHOD

ELSE

OBJECT LET m_oExcelApp.Visible = vTrue

END IF

	' Create the Events handler interface

	XlEvents = CLASS "Class_AppEvents"

	IF ISFALSE(ISOBJECT(XlEvents)) THEN

		msgbox("Error creating the event interface.")

	END IF

	' Attach the Events handler interface to the Agent Control

	EVENTS FROM m_oExcelApp CALL XlEvents

END METHOD

METHOD Unload()

SET m_oExcelApp = NOTHING

SET m_oExcelWorkbook = NOTHING

SET m_oExcelWorkSheet = NOTHING

	set XlEvents			 = nothing

END METHOD

’ Open file

METHOD OPEN(FileN AS STRING)

LOCAL vInFile AS VARIANT

vInFile = FileN

OBJECT CALL m_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

			OBJECT CALL m_oExcelWorkbook.Close(SaveChanges=vFalse)

		catch

			outputdebugstring "Close XL in Class failed probably because someone manually closed it"

		end try

END IF

END METHOD

’ Select WorkSheet

METHOD SelectWS(WorkSheet AS STRING)

LOCAL vInSheet AS VARIANT

vInSheet = WorkSheet

OBJECT CALL m_oExcelApp.Sheets(vInSheet).SELECT

OBJECT GET m_oExcelApp.ActiveSheet TO m_vExcelWorkSheet

SET m_oExcelWorkSheet = m_vExcelWorkSheet

END METHOD

’ Get used Cells to array

METHOD GetUsed()

LOCAL lbrow AS LONG

LOCAL ubrow AS LONG

LOCAL lbcol AS LONG

LOCAL ubcol AS LONG

LOCAL lrow AS LONG

LOCAL lcol AS LONG

LOCAL lvType AS LONG

LOCAL vNoParenArray AS VARIANT

DIM vTwoDimArray(0) AS VARIANT

	local w						as wstring

OBJECT GET m_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 TO ubrow, lbcol TO ubcol)

FOR lrow = lbrow TO ubrow

FOR lcol = lbcol TO ubcol

lvType = VARIANTVT(vTwoDimArray(lrow,lcol))

IF lvType = 0 OR lvType = 1 THEN ’ nothing or null

ELSEIF lvType = 8 THEN 'string

				w = variant$$(vTwoDimArray(lrow,lcol))

				'outputdebugstring "variant " + w

sArray(lrow,lcol) = w

ELSEIF lvType => 2 AND lvType <= 6 THEN

sArray(lrow,lcol) = FORMAT$(VARIANT#(vTwoDimArray(lrow,lcol)))

ELSE

sArray(lrow,lcol) = “unknown”

END IF

NEXT

NEXT

END METHOD

method StoreRange(Param1 as string, Param2 as string)

	dim vArray 					as variant

	dim vParam1					as Variant

	dim vParam2					as variant

	vParam1 = Param1

	vParam2 = Param2

	vArray = sInArray()

	object let m_oExcelWorkSheet.Cells.Range(vParam1, vParam2) = vArray

END METHOD

method StoreValue(c as string, value as String)

	local vCell 				as variant

	local vValue				as Variant

	vCell = c

	vValue = value

	object let m_oExcelWorkSheet.Range(vCell).value = vValue

END METHOD

method ReadString(c as string) as string

	local vCell 				as variant

	local vValue				as Variant

	local w						as wstring

	vCell = c

	object get m_oExcelWorkSheet.Range(vCell).value to vValue

	w = Variant$$(vValue)

	method = w

END METHOD

method ReadNumeric(c as string) as double

	local vCell 				as variant

	local vValue				as Variant

	local w						as wstring

	vCell = c

	object get m_oExcelWorkSheet.Range(vCell).value to vValue

	method = Variant#(vValue)

END METHOD

method ScreenUpdating(b as long)

	local v as Variant

	v = b

	object let m_oExcelApp.ScreenUpdating = v

END METHOD

method EnableCalculation(b as long)

	local v as Variant

	v = b

	object let m_oExcelWorkSheet.EnableCalculation = v

END METHOD

' Set Calcultion mode can be xlCalculationManual, xlCalculationAutomatic or xlCalculationSemi

method SetCalculationMode(b as long)

	local v as Variant

	v = b

	object let m_oExcelApp.Calculation = v

END METHOD

Method GetCalculationState() as long

	Local vValue				as variant

	object Get m_oExcelApp.CalculationState to vValue

	Method = VARIANT#(vValue)

END METHOD

METHOD CalcNow()

	Object call m_oExcelApp.Calculate()

END METHOD

METHOD CalcWSNow()

	Object call m_oExcelWorkSheet.Calculate()

END METHOD

END INTERFACE

END CLASS

···

Jon Eskdale

03333 443377

07530 112233

beat me to it. will see what I can find

···

On Sun, Mar 10, 2019 at 11:32 AM Jon Eskdale jon@sailwave.com [sailwave] sailwave@yahoogroups.com wrote:

Hi Kirk,

If you can supply a Com automation documentation 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’ve developed 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 AS STRING

INSTANCE m_oExcelApp AS Excel_Application

INSTANCE m_oExcelWorkbook AS Excel_Workbook

INSTANCE m_vExcelWorkbook AS VARIANT

INSTANCE m_oExcelWorkSheet AS Excel_WorkSheet

INSTANCE m_vExcelWorkSheet AS VARIANT

INSTANCE vFalse AS VARIANT

INSTANCE vTrue AS VARIANT

'INSTANCE Xl

instance XlEvents as AppEvents

INTERFACE IXL : INHERIT IAUTOMATION

PROPERTY GET XLFile() AS STRING : PROPERTY = m_FileName : END PROPERTY

PROPERTY SET XLFile( BYVAL sFileName 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? If not, terminate this app

IF ISFALSE ISOBJECT(m_oExcelApp) OR ERR THEN

  	outputdebugstring "Error  " & Str$(ERR) & " " & $PROGID_Excel_Application

MSGBOX “Excel could not be opened. Please check that Excel and VBA are installed.”,“SWHelper - Error”

EXIT METHOD

ELSE

OBJECT LET m_oExcelApp…Visible = vTrue

END IF

  ' Create the Events handler interface
  XlEvents = CLASS "Class_AppEvents"
  IF ISFALSE(ISOBJECT(XlEvents)) THEN
  	msgbox("Error creating the event interface.")
  END IF
  ' Attach the Events handler interface to the Agent Control
  EVENTS FROM m_oExcelApp CALL XlEvents

END METHOD

METHOD Unload()

SET m_oExcelApp = NOTHING

SET m_oExcelWorkbook = NOTHING

SET m_oExcelWorkSheet = NOTHING

  set XlEvents			 = nothing

END METHOD

’ Open file

METHOD OPEN(FileN AS STRING)

LOCAL vInFile AS VARIANT

vInFile = FileN

OBJECT CALL m_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
  		OBJECT CALL m_oExcelWorkbook.Close(SaveChanges=vFalse)
  	catch
  		outputdebugstring "Close XL in Class failed probably because someone manually closed it"
  	end try

END IF

END METHOD

’ Select WorkSheet

METHOD SelectWS(WorkSheet AS STRING)

LOCAL vInSheet AS VARIANT

vInSheet = WorkSheet

OBJECT CALL m_oExcelApp.Sheets(vInSheet).SELECT

OBJECT GET m_oExcelApp.ActiveSheet TO m_vExcelWorkSheet

SET m_oExcelWorkSheet = m_vExcelWorkSheet

END METHOD

’ Get used Cells to array

METHOD GetUsed()

LOCAL lbrow AS LONG

LOCAL ubrow AS LONG

LOCAL lbcol AS LONG

LOCAL ubcol AS LONG

LOCAL lrow AS LONG

LOCAL lcol AS LONG

LOCAL lvType AS LONG

LOCAL vNoParenArray AS VARIANT

DIM vTwoDimArray(0) AS VARIANT

  local w						as wstring

OBJECT GET m_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 TO ubrow, lbcol TO ubcol)

FOR lrow = lbrow TO ubrow

FOR lcol = lbcol TO ubcol

lvType = VARIANTVT(vTwoDimArray(lrow,lcol))

IF lvType = 0 OR lvType = 1 THEN ’ nothing or null

ELSEIF lvType = 8 THEN 'string

  			w = variant$$(vTwoDimArray(lrow,lcol))
  			'outputdebugstring "variant " + w

sArray(lrow,lcol) = w

ELSEIF lvType => 2 AND lvType <= 6 THEN

sArray(lrow,lcol) = FORMAT$(VARIANT#(vTwoDimArray(lrow,lcol)))

ELSE

sArray(lrow,lcol) = “unknown”

END IF

NEXT

NEXT

END METHOD

method StoreRange(Param1 as string, Param2 as string)

  dim vArray 					as variant
  dim vParam1					as Variant
  dim vParam2					as variant
  vParam1 = Param1
  vParam2 = Param2
  vArray = sInArray()
  object let m_oExcelWorkSheet.Cells.Range(vParam1, vParam2) = vArray

END METHOD

method StoreValue(c as string, value as String)

  local vCell 				as variant
  local vValue				as Variant
  vCell = c
  vValue = value
  object let m_oExcelWorkSheet.Range(vCell).value = vValue

END METHOD

method ReadString(c as string) as string

  local vCell 				as variant
  local vValue				as Variant
  local w						as wstring
  vCell = c
  object get m_oExcelWorkSheet.Range(vCell).value to vValue
  w = Variant$$(vValue)
  method = w

END METHOD

method ReadNumeric(c as string) as double

  local vCell 				as variant
  local vValue				as Variant
  local w						as wstring
  vCell = c
  object get m_oExcelWorkSheet.Range(vCell).value to vValue
  method = Variant#(vValue)

END METHOD

method ScreenUpdating(b as long)

  local v as Variant
  v = b
  object let m_oExcelApp.ScreenUpdating = v

END METHOD

method EnableCalculation(b as long)

  local v as Variant
  v = b
  object let m_oExcelWorkSheet.EnableCalculation = v

END METHOD

’ Set Calcultion mode can be xlCalculationManual, xlCalculationAutomatic or xlCalculationSemi

method SetCalculationMode(b as long)

  local v as Variant
  v = b
  object let m_oExcelApp.Calculation = v

END METHOD

Method GetCalculationState() as long

  Local vValue				as variant
  object Get m_oExcelApp.CalculationState to vValue
  Method = VARIANT#(vValue)

END METHOD

METHOD CalcNow()

  Object call m_oExcelApp.Calculate()

END METHOD

METHOD CalcWSNow()

  Object call m_oExcelWorkSheet.Calculate()

END METHOD

END INTERFACE

END CLASS

Jon Eskdale

03333 443377

07530 112233

On Sun, 10 Mar 2019 at 15:10, Kirk Robertson jkirkrobertson@gmail.com [sailwave] sailwave@yahoogroups.com wrote:

I know you are all pretty busy right and am not begging.

But has any thought been given to supporting Libre Office as alternative to Microsoft.

Must admit I like Libre Office so much, I have donated to project (not that my donation(s) amounts to “a hill of beans”).

Would be neat to have interface to its spreadsheet

Sent from Mail 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 you want 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 has already replied

Kind regards,

Huw

On 10/03/2019 14:27, kirkrobertson406@yahoo.com [sailwave] wrote:

Has anyone successfully used Sailwave with Libre Office instead of Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

Virus-free. www.avast.com

Hi Kirk,

  That would be fantastic if you are able to provide Jon with 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:

jkirkrobertson@gmail.com

beat me to it. will see what I can find

            On Sun, Mar 10, 2019 at

11:32 AM Jon Eskdale jon@sailwave.com [sailwave]
<sailwave@yahoogroups.com >
wrote:

Hi Kirk,

                          If you can supply a Com automation

documentation 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've developed

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        AS

STRING

                            INSTANCE m_oExcelApp       AS

Excel_Application

                            INSTANCE m_oExcelWorkbook  AS

Excel_Workbook

                            INSTANCE m_vExcelWorkbook  AS

VARIANT

                            INSTANCE m_oExcelWorkSheet AS

Excel_WorkSheet

                            INSTANCE m_vExcelWorkSheet AS

VARIANT

                            INSTANCE vFalse            AS

VARIANT

                            INSTANCE vTrue             AS

VARIANT

                              'INSTANCE

Xl

instance	XlEvents				                                as

AppEvents

                            INTERFACE IXL : INHERIT

IAUTOMATION

                            PROPERTY GET XLFile() AS STRING :

PROPERTY = m_FileName : END PROPERTY

                            PROPERTY SET XLFile( BYVAL

sFileName 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? If

not, terminate this app

                            IF ISFALSE

ISOBJECT(m_oExcelApp) OR ERR THEN

  	                                outputdebugstring

"Error " & Str$(ERR) & " "
& $PROGID_Excel_Application

                            MSGBOX "Excel could not be

opened. Please check that Excel and VBA
are installed.",“SWHelper - Error”

EXIT METHOD

ELSE

                            OBJECT LET

m_oExcelApp…Visible = vTrue

END IF

                                  '

Create the Events handler interface

                                  XlEvents

= CLASS “Class_AppEvents”

                                  IF

ISFALSE(ISOBJECT(XlEvents)) THEN

  	                                msgbox("Error

creating the event interface.")

                                  END

IF

                                  '

Attach the Events handler interface to
the Agent Control

                                  EVENTS

FROM m_oExcelApp CALL XlEvents

END METHOD

METHOD Unload()

SET m_oExcelApp = NOTHING

SET m_oExcelWorkbook = NOTHING

SET m_oExcelWorkSheet = NOTHING

                                  set

XlEvents
= nothing

END METHOD

’ Open file

METHOD OPEN(FileN AS STRING)

LOCAL vInFile AS VARIANT

vInFile = FileN

                            OBJECT CALL

m_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
  		                                OBJECT

CALL
m_oExcelWorkbook.Close(SaveChanges=vFalse)

  	catch
  		                                outputdebugstring

“Close XL in Class failed probably
because someone manually closed it”

  	                                end

try

END IF

END METHOD

’ Select WorkSheet

                            METHOD SelectWS(WorkSheet AS

STRING)

LOCAL vInSheet AS VARIANT

vInSheet = WorkSheet

                            OBJECT CALL

m_oExcelApp.Sheets(vInSheet).SELECT

                            OBJECT GET

m_oExcelApp.ActiveSheet TO
m_vExcelWorkSheet

                            SET m_oExcelWorkSheet =

m_vExcelWorkSheet

END METHOD

’ Get used Cells to array

METHOD GetUsed()

LOCAL lbrow AS LONG

LOCAL ubrow AS LONG

LOCAL lbcol AS LONG

LOCAL ubcol AS LONG

LOCAL lrow AS LONG

LOCAL lcol AS LONG

LOCAL lvType AS LONG

                            LOCAL vNoParenArray     AS

VARIANT

DIM vTwoDimArray(0) AS
VARIANT

                                  local

w as
wstring

                            OBJECT GET

m_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 TO ubrow,

lbcol TO ubcol)

FOR lrow = lbrow TO ubrow

FOR lcol = lbcol TO ubcol

                            lvType =

VARIANTVT(vTwoDimArray(lrow,lcol))

                            IF lvType = 0  OR  lvType

= 1 THEN ’ nothing or null

                            ELSEIF lvType = 8 THEN

'string

  			                                w

= variant$$(vTwoDimArray(lrow,lcol))

  			                                'outputdebugstring

"variant " + w

sArray(lrow,lcol) = w

                            ELSEIF lvType => 2 AND

lvType <= 6 THEN

                            sArray(lrow,lcol) =

FORMAT$(VARIANT#(vTwoDimArray(lrow,lcol)))

ELSE

                            sArray(lrow,lcol) =

“unknown”

END IF

NEXT

NEXT

END METHOD

                              method

StoreRange(Param1 as string, Param2 as
string)

                                  dim

vArray as
variant

                                  dim

vParam1 as
Variant

                                  dim

vParam2 as
variant

                                  vParam1

= Param1

                                  vParam2

= Param2

                                  vArray

= sInArray()

                                  object

let
m_oExcelWorkSheet.Cells.Range(vParam1,
vParam2) = vArray

END METHOD

                              method

StoreValue(c as string, value as String)

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  vCell

= c

                                  vValue

= value

                                  object

let m_oExcelWorkSheet.Range(vCell).value
= vValue

END METHOD

                              method

ReadString(c as string) as string

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  local

w as
wstring

                                  vCell

= c

                                  object

get m_oExcelWorkSheet.Range(vCell).value
to vValue

                                  w

= Variant$$(vValue)

                                  method

= w

END METHOD

                              method

ReadNumeric(c as string) as double

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  local

w as
wstring

                                  vCell

= c

                                  object

get m_oExcelWorkSheet.Range(vCell).value
to vValue

                                  method

= Variant#(vValue)

END METHOD

                              method

ScreenUpdating(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelApp.ScreenUpdating = v

END METHOD

                              method

EnableCalculation(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelWorkSheet.EnableCalculation
= v

END METHOD

                              '

Set Calcultion mode can be
xlCalculationManual,
xlCalculationAutomatic or
xlCalculationSemi

                              method

SetCalculationMode(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelApp.Calculation = v

END METHOD

                              Method

GetCalculationState() as long

                                  Local

vValue as
variant

                                  object

Get m_oExcelApp.CalculationState to
vValue

                                  Method

= VARIANT#(vValue)

END METHOD

                              METHOD

CalcNow()

                                  Object

call m_oExcelApp.Calculate()

END METHOD

                              METHOD

CalcWSNow()

                                  Object

call m_oExcelWorkSheet.Calculate()

END METHOD

END INTERFACE

END CLASS

                                        Jon

Eskdale

03333 443377

07530 112233

                        On Sun, 10

Mar 2019 at 15:10, Kirk Robertson jkirkrobertson@gmail.com
[sailwave] <sailwave@yahoogroups.com >
wrote:

                                    I know you

are all pretty busy right and am
not begging.

                                    But has any

thought been given to supporting
Libre Office as alternative to
Microsoft.

                                    Must admit I

like Libre Office so much, I
have donated to project (not
that my donation(s) amounts to
“a hill of beans”).

                                    Would be neat

to have interface to its
spreadsheet

Sent from Mail
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 you want

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 has

already replied

Kind regards,

Huw

                                            On

10/03/2019 14:27, kirkrobertson406@yahoo.com
[sailwave] wrote:

                                              Has anyone

successfully used
Sailwave with Libre
Office instead of
Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

                                                      Virus-free.

www.avast.com

Hiw Pearce, Jon. have not forgotten promise

looks like you are in full season there; ice still on river here. regarding Libre Office & VB, it does look like it supports a fair measure; although the devil is always in the details.

When winter comes for you; you can look at:

https://stackoverflow.com/…/how-do-i-make-vba-code-compatible-with-libre-office

https://documentation.libreoffice.org/assets/Uploads/Documentation/en/MACROS/RefCards/LibOBasic-2-Overview-Flat-Letter-EN-v110.pdf

https://blog.documentfoundation.org/blog/2018/02/19/making-macro-programming-breeze-basic-api-reference-cards/

I not a VB programmer myselft.

The esoterics of C++ is usually my “fun”

···

On Sun, Mar 10, 2019 at 12:02 PM Huw Pearce huw.pearce@bcs.org.uk [sailwave] sailwave@yahoogroups.com wrote:

Hi Kirk,

  That would be fantastic if you are able to provide Jon with 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 > jkirkrobertson@gmail.com [sailwave] wrote:

beat me to it. will see what I can find

            On Sun, Mar 10, 2019 at > > 11:32 AM Jon Eskdale jon@sailwave.com [sailwave] > > <sailwave@yahoogroups.com                > > > wrote:

Hi Kirk,

                          If you can supply a Com automation

documentation 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've developed

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        AS

STRING

                            INSTANCE m_oExcelApp       AS

Excel_Application

                            INSTANCE m_oExcelWorkbook  AS

Excel_Workbook

                            INSTANCE m_vExcelWorkbook  AS

VARIANT

                            INSTANCE m_oExcelWorkSheet AS

Excel_WorkSheet

                            INSTANCE m_vExcelWorkSheet AS

VARIANT

                            INSTANCE vFalse            AS

VARIANT

                            INSTANCE vTrue             AS

VARIANT

                              'INSTANCE

Xl

instance	XlEvents				                                as

AppEvents

                            INTERFACE IXL : INHERIT

IAUTOMATION

                            PROPERTY GET XLFile() AS STRING :

PROPERTY = m_FileName : END PROPERTY

                            PROPERTY SET XLFile( BYVAL

sFileName 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? If

not, terminate this app

                            IF ISFALSE

ISOBJECT(m_oExcelApp) OR ERR THEN

  	                                outputdebugstring

"Error " & Str$(ERR) & " "
& $PROGID_Excel_Application

                            MSGBOX "Excel could not be

opened. Please check that Excel and VBA
are installed.",“SWHelper - Error”

EXIT METHOD

ELSE

                            OBJECT LET

m_oExcelApp…Visible = vTrue

END IF

                                  '

Create the Events handler interface

                                  XlEvents

= CLASS “Class_AppEvents”

                                  IF

ISFALSE(ISOBJECT(XlEvents)) THEN

  	                                msgbox("Error

creating the event interface.")

                                  END

IF

                                  '

Attach the Events handler interface to
the Agent Control

                                  EVENTS

FROM m_oExcelApp CALL XlEvents

END METHOD

METHOD Unload()

SET m_oExcelApp = NOTHING

SET m_oExcelWorkbook = NOTHING

SET m_oExcelWorkSheet = NOTHING

                                  set

XlEvents
= nothing

END METHOD

’ Open file

METHOD OPEN(FileN AS STRING)

LOCAL vInFile AS VARIANT

vInFile = FileN

                            OBJECT CALL

m_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
  		                                OBJECT

CALL
m_oExcelWorkbook.Close(SaveChanges=vFalse)

  	catch
  		                                outputdebugstring

“Close XL in Class failed probably
because someone manually closed it”

  	                                end

try

END IF

END METHOD

’ Select WorkSheet

                            METHOD SelectWS(WorkSheet AS

STRING)

LOCAL vInSheet AS VARIANT

vInSheet = WorkSheet

                            OBJECT CALL

m_oExcelApp.Sheets(vInSheet).SELECT

                            OBJECT GET

m_oExcelApp.ActiveSheet TO
m_vExcelWorkSheet

                            SET m_oExcelWorkSheet =

m_vExcelWorkSheet

END METHOD

’ Get used Cells to array

METHOD GetUsed()

LOCAL lbrow AS LONG

LOCAL ubrow AS LONG

LOCAL lbcol AS LONG

LOCAL ubcol AS LONG

LOCAL lrow AS LONG

LOCAL lcol AS LONG

LOCAL lvType AS LONG

                            LOCAL vNoParenArray     AS

VARIANT

DIM vTwoDimArray(0) AS
VARIANT

                                  local

w as
wstring

                            OBJECT GET

m_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 TO ubrow,

lbcol TO ubcol)

FOR lrow = lbrow TO ubrow

FOR lcol = lbcol TO ubcol

                            lvType =

VARIANTVT(vTwoDimArray(lrow,lcol))

                            IF lvType = 0  OR  lvType

= 1 THEN ’ nothing or null

                            ELSEIF lvType = 8 THEN

'string

  			                                w

= variant$$(vTwoDimArray(lrow,lcol))

  			                                'outputdebugstring

"variant " + w

sArray(lrow,lcol) = w

                            ELSEIF lvType => 2 AND

lvType <= 6 THEN

                            sArray(lrow,lcol) =

FORMAT$(VARIANT#(vTwoDimArray(lrow,lcol)))

ELSE

                            sArray(lrow,lcol) =

“unknown”

END IF

NEXT

NEXT

END METHOD

                              method

StoreRange(Param1 as string, Param2 as
string)

                                  dim

vArray as
variant

                                  dim

vParam1 as
Variant

                                  dim

vParam2 as
variant

                                  vParam1

= Param1

                                  vParam2

= Param2

                                  vArray

= sInArray()

                                  object

let
m_oExcelWorkSheet.Cells.Range(vParam1,
vParam2) = vArray

END METHOD

                              method

StoreValue(c as string, value as String)

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  vCell

= c

                                  vValue

= value

                                  object

let m_oExcelWorkSheet.Range(vCell).value
= vValue

END METHOD

                              method

ReadString(c as string) as string

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  local

w as
wstring

                                  vCell

= c

                                  object

get m_oExcelWorkSheet.Range(vCell).value
to vValue

                                  w

= Variant$$(vValue)

                                  method

= w

END METHOD

                              method

ReadNumeric(c as string) as double

                                  local

vCell as
variant

                                  local

vValue as
Variant

                                  local

w as
wstring

                                  vCell

= c

                                  object

get m_oExcelWorkSheet.Range(vCell).value
to vValue

                                  method

= Variant#(vValue)

END METHOD

                              method

ScreenUpdating(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelApp.ScreenUpdating = v

END METHOD

                              method

EnableCalculation(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelWorkSheet.EnableCalculation
= v

END METHOD

                              '

Set Calcultion mode can be
xlCalculationManual,
xlCalculationAutomatic or
xlCalculationSemi

                              method

SetCalculationMode(b as long)

                                  local

v as Variant

                                  v

= b

                                  object

let m_oExcelApp.Calculation = v

END METHOD

                              Method

GetCalculationState() as long

                                  Local

vValue as
variant

                                  object

Get m_oExcelApp.CalculationState to
vValue

                                  Method

= VARIANT#(vValue)

END METHOD

                              METHOD

CalcNow()

                                  Object

call m_oExcelApp.Calculate()

END METHOD

                              METHOD

CalcWSNow()

                                  Object

call m_oExcelWorkSheet.Calculate()

END METHOD

END INTERFACE

END CLASS

                                        Jon

Eskdale

03333 443377

07530 112233

                        On Sun, 10 > > > Mar 2019 at 15:10, Kirk Robertson jkirkrobertson@gmail.com > > >                             [sailwave] <sailwave@yahoogroups.com                            > > > > wrote:
                                    I know you

are all pretty busy right and am
not begging.

                                    But has any

thought been given to supporting
Libre Office as alternative to
Microsoft.

                                    Must admit I

like Libre Office so much, I
have donated to project (not
that my donation(s) amounts to
“a hill of beans”).

                                    Would be neat

to have interface to its
spreadsheet

Sent from Mail
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 you want

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 has

already replied

Kind regards,

Huw

                                            On

10/03/2019 14:27, kirkrobertson406@yahoo.com
[sailwave] wrote:

                                              Has anyone

successfully used
Sailwave with Libre
Office instead of
Microsoft Office

https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif

                                                      Virus-free.

www.avast.com

Hi Kirk,
Thanks for all those links but they are to do with automating Libre Office from within Libre Office.

What Sailwave does and if you wish to use Libre Office is automate the spreadsheet through COM automation.

So you need to be able to insert data and read data as well as a few other things from an external program such as C++ program

If you can supply the code to do it in C++ then I’ll happily use that.

Jon

···

Jon Eskdale

03333 443377

07530 112233