Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have used macro to get the number of chart rows like below:
set table = ActiveDocument.GetSheetObject("CH634")
count=table.GetRowCount-1
Now I want to use ocx instead of macro.How can I do this in c#.
I couldn't find a way when searching API.
Who can help me?
thanks!
Application app = new Application();
Doc doc = app.OpenDoc(@"<PATH to your QVW file>");
//you must explicit cast your QV object, here (TableBox)
var mBox = (TableBox) doc.GetSheetObject("TB07");
int countRows = mBox.GetRowCount();
hi steoelpr
I want to use OCX.How to achieve it in c#.thanks!
This short snippet is C# OCX code.
Hello,
In case the OCX hasn't been registred during install, you need to get the OCX file.
Once you have it, per command prompt you can register it while doing regsvr32 qlikview.ocx
Then in VSTO, you need to add it as reference in your libraries and integrate it into your project.
When you did all those steps, you might check the the OCX manual of QlikView.
Then as steoelpr mentioned:
Application app = new Application();
Doc doc = app.OpenDoc(@"<PATH to your QVW file>");
//you must explicit cast your QV object, here (TableBox)
var mBox = (TableBox) doc.GetSheetObject("TB07");
int countRows = mBox.GetRowCount();
**Edited:
For OCX you find it here: http://community.qlik.com/docs/DOC-1809
Didn't search yet for the new one, but there is have the essentiel too.
Hello
I use this code in c#,error below:
please help me.thanks!
First of all,
you need to return the item type, and if you want to get a sheet name, you need to do:
public string ItemName
{
get
{ return SheetObject.GetObjectId().Replace("Document\\", ""); }
}
Once you have the sheet name, you can access on the items:
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());
}
}
Now that you acces the item type, you can access the different items:
public IList<QlikViewItem> GetItems()
{
if (qvReport == null)
throw new Exception("Load a QlikView Report before accessing Shapes");
if (items == null)
{
IList<QlikViewItem> list = new List<QlikViewItem>();
for (int i = 0; i < qvReport.NoOfSheets(); i++)
{
Sheet s = qvReport.GetSheet(i.ToString());
for (int j = 0; j < s.NoOfSheetObjects(); j++)
{
list.Add(new QlikViewItem() { Sheet = s, SheetObject = s.SheetObjects(j.ToString()) });
}
}
items = list;
}
return items;
}
hi mike27015
I want to get the number of chart rows in OCX?please help me.thanks!
You might check the OCX manual and read it ....
QlikViewDocument qvReport = new QlikViewDocument();
IList<QlikViewItem> qlikItems = qvReport.GetItems();
QlikViewItem item = qlikItems.SingleOrDefault(c => c.SheetName == qvSheetName
&& c.ItemName == qvShapeName);
switch (item.ItemType)
{
case QlikViewItemType.DimensionTable:
{
item.SheetObject.***
}
}
Like this you can access all items from your document.
Now you can check what type it is and if it is a table chart, you use SheetObject, now it's your job to access its data. Try DbGetTableData, DbGetTableInfo, GetTableAsText. If you still can't figure out how to access it via C#, then you can open your QlikView document, press CTRL+M and create trigger which executes a macro when you open your document that does:
set obj=ActiveDocument.GetSheetObject("Your table name")
obj.export "your file directory\file.txt" ,","
It will export your table into a txt file.
And in your C#, you can read this file which represents a table.
Now your job to choose how to do it.
hello
I want to get the number of chart rows in OCX?
chart in ocx:
How can I do this in c#. please help me.thanks!