Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro to export a table to Calc (OpenOffice)

Hi

i need an help to improve a macro to export a table to Calc,the OpenOffice program.

I've found this macro that open a Calc window and copy a table to clipboardsub

Dim noSM

Dim oDesk

Dim oDoc

Dim aNoArgs()

Set oSM = CreateObject("com.sun.star.ServiceManager")

Set oDesk=oSM.createInstance("com.sun.star.frame.Desktop")

Set oDoc = oDesk.loadComponentFromURL("private:factory/scalc", "_blank", 0, aNoArgs)

ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true

end sub

I don't know how to paste my table "CH01" in Calc.

This is the BASIC macro to paste the table but in qv it doesn't work

sub paste
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$D$9"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())


end sub

4 Replies
Not applicable
Author

hi,

How about this: clicking the "Export to Excel" icon on various QV objects will download an .XLS file . By default that opens with Excel.

If your users have OpenOffice installed instead of MS Office, XLS files will open with OpenOffice

-Alex

Not applicable
Author

hi,

thank you for the answer, but i want create active button to export more than one chart in one time, so i need how to paste....

Not applicable
Author

Hi, to export by macro a table/pivot to an openoffice/libreoffice calc i have used the usual "obj.ExportBiff "C:\.."" that use the microsoft excel dll. So to have the same dll i have tried to install microsoft ExcelViewer (that it's license free) and so the macro works perfectly. After you can also open the file.xls in a open calc program as usual..

Hope to help you

coskunist
Contributor III
Contributor III

Dear Luca,

Did you find the macro code  to paste the table?


Thank you.