private int ExecuteExportJPG(string objectId, string fileName) { this._exportFileName = fileName; var obj = this.FindSheetObject(objectId); QlikView.TableBox table = obj as QlikView.TableBox; QlikView.Graph graph = obj as QlikView.Graph; QlikView.PivotTableBox pivotBox = obj as QlikView.PivotTableBox; QlikView.StraightTableBox straightTable = obj as QlikView.StraightTableBox; if (obj != null) { if (obj.GetSheet().IsActive() == false) { obj.GetSheet().Activate(); //special case for china dash if (this._filter != null && (this._filter.Name == "ChinaSalesFunnelDash_Summary" || this._filter.Name == "ShanghaiSalesFunnelDash_Summary")) { System.Threading.Thread.Sleep(120 * 1000); } else { System.Threading.Thread.Sleep(10 * 1000); } if (this._filter != null) { this._filter = null; } } if (table != null) { if (table.IsMinimized()) { table.Restore(); } table.ExportBiff(this._exportFileName); return(0); } if (graph != null) { /*Export format * 0 = HTML * 1 = Text delimited * 2 = bitmap image * 3 = XML * 4 = QVD * 5 = BIFF (Excel) * */ if (graph.IsMinimized()) { graph.Restore(); } bool ok = graph.ExportEx(this._exportFileName, 2); if (ok) { return(0); } else { return(-1); } } if (pivotBox != null) { if (pivotBox.IsMinimized()) { pivotBox.Restore(); } pivotBox.ExportBitmapToFile(this._exportFileName); return(0); } if (straightTable != null) { if (straightTable.IsMinimized()) { straightTable.Restore(); } straightTable.ExportBitmapToFile(this._exportFileName); return(0); } } return(-1); }