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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export2Excel multiple charts using JavaScript

Hi All,

I am trying to write a JavaScript Macro to export multiple charts data to an excel, but its giving error at CopyTableToClipboard, not sure whether I am doing correct or not, please help me in this 

This is the code I am using & also attached error & sample qvw app.JS_Error.png

function print_excel()
{


var objXL = new ActiveXObject("Excel.Application");
var objWB = objXL.Workbooks.Add();
var objWS = objWB.ActiveSheet;

//var obj = document.getElementById("TB01")
var obj = ActiveDocument.GetSheetObject("TB01");
var XLSheet = objWB.Worksheets(1);
obj.CopyTableToClipboard = true;
XLSheet.Paste;


//objWS.Range("A1", "L1").Font.Bold = true;

objWS.Range("A1", "Z1").EntireColumn.AutoFit();

//objWS.Range("C1", "C1").ColumnWidth = 50;

objXL.Visible = true;

}

Thanks in Advance

Labels (1)
2 Replies
Not applicable
Author

Any help?

sadickbasha
Partner - Contributor III
Partner - Contributor III

Use that line as per below

 

obj.CopyTableToClipboard(1)

Thanks

Sadick