1 Reply Latest reply: Mar 22, 2013 5:46 AM by Micael Leal RSS

    OCX with .Net ObjectId definition

      hi,

       

      We're trying to work with the QlikView OCX COM object embedded in .Net and we've encountered a few problems:

      1. We'd like to define the ObjectId in the code. We've tried the following code :

           axQlikObj1.ObjectID = "Document\\CH02";       

           axQlikObj2.ObjectID = "Document\\LB119";

      after the intializeComponenets() method. When the window is displayed it displays the qvw we've defined (using OpenDocument) but not the specific object.

       

      2. We'd like to define the QV selections in the code rather than select them on screen (the selections would be done in our .Net wrapper and not through QV itself). We haven't been able to locate the right function to use.

       

      PLEASE HELP US

      thanx

        • Re: OCX with .Net ObjectId definition

          Hello,

          Lucky you.

          I've been doing this too reccently.

          Hope this might help you to find a solution.

           

          public QlikViewDocuéent()

          {

               axQlikOCX = new AxQlikOCXLib.AxQlikOCX();

               axQlikOCX.CreateControl();

          }

           

           

           

          namespace QlikOffice.Core

          {

              /// <summary>

              /// Define a representation of a QlikView item(Shape/table/filter)

              /// Inherit from DataObject to autorize drag&drop operation with the object

              /// </summary>

              public class QlikViewItem : DataObject

              {

                  /// Qlikview sheet that contains the item

                  public Sheet Sheet { get; set; }

           

                  public SheetObject SheetObject { get; set; }

           

                  public string ItemName

                  {

                      get

                      {

                          return SheetObject.GetObjectId().Replace("Document\\", "");

                      }

                  }

                  public string SheetName

                  {

                      get

                      {

                          return Sheet.GetProperties().SheetId.Replace("Document\\", "");

                      }

                  }

           

                  public QlikViewItemType ItemType

                  {

                      get

                      {

                          if (!Enum.IsDefined(typeof(QlikViewItemType), (int)SheetObject.GetObjectType()))

                              throw new Exception("Qlikview Shape Type not supported by the application. Item Type Id:" + SheetObject.GetObjectType().ToString());

           

                          return (QlikViewItemType)Enum.ToObject(typeof(QlikViewItemType), SheetObject.GetObjectType());

                      }

                  }

           

                  /// Get an image representation of a qlikview item

                  public Image Thumbnail

                  {

                      get

                      {

                          try

                          {

                              SheetObject.CopyBitmapToClipboard();

                              if (Clipboard.ContainsImage())

                                  return Clipboard.GetImage();

                              else

                                  MessageBox.Show("No picture in clipboard");

                          }

                          catch

                          {

                              MessageBox.Show("fail to load thumbnail");

                          }

                          return null;

                      }

                  }

           

              }

          }