Skip to content

Instantly share code, notes, and snippets.

@jonhilt
Created March 2, 2012 11:21
Show Gist options
  • Save jonhilt/1957868 to your computer and use it in GitHub Desktop.
Save jonhilt/1957868 to your computer and use it in GitHub Desktop.
Qlikview
#region
using System;
using System.Threading;
using System.Windows.Forms;
using QlikView;
using Application = QlikView.Application;
#endregion
namespace Hello_Qlikview_Win
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
void button1_Click(object sender, EventArgs e)
{
var app = new Application();
var doc = app.OpenDoc(@"\\acdata02\g$\bi\development\documents\Catalogue Import Pass 2(b).qvw");
doc.Activate();
doc.NextTab();
Thread.Sleep(5000);
for (int sheetNo = 0; sheetNo < doc.NoOfSheets(); sheetNo++)
{
Thread.Sleep(5000);
doc.ActivateSheet(sheetNo.ToString());
}
for (int sheetNo = 0; sheetNo < doc.NoOfSheets(); sheetNo++)
{
dynamic objects = doc.GetSheet(sheetNo.ToString()).GetSheetObjects();
for (int i = 0; i < objects.Length; i++)
{
dynamic report = objects.GetValue(i);
if (report.GetObjectType() == (short) ObjectType.EQ_TYPE_STRAIGHTTABLEBOX)
{
StraightTableBox table = (StraightTableBox) report;
ICaption name = table.GetCaption();
if (table != null) table.ExportBiff(@"c:\temp\catalogue\forSQL\" + name.Name.v + ".xls");
}
}
}
app.Quit();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment