Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to resize a text object in Qliksense using .Net SDK. But it is throwing below error.
"Accessing layout property while in suspended layout"
ILocation LocalQliksense = Qlik.Engine.Location.Local;
IAppIdentifier foundAppIdentifier = LocalQliksense.AppWithName("Retail Sales");
IApp application = LocalQliksense.App(foundAppIdentifier);
ISheetList sheetlist = application.GetSheetList();
var sh = sheetlist.Items.ToList()[0].Info.Id;
ISheet sheet = application.GetSheet(sh);
var text1 = sheet.GetTextImage("MyAutoPlacedText1");
using (sheet.SuspendedLayout)
{
var text1Cell = sheet.CellFor(text1);
text1Cell.SetBounds(1, 2, 2, 2);
}
application.DoSave();
I just used the code from the below link,
Please help....
Thanks in Advance
Prabbhu Appu
Hi,
this code should work:
using (sheet.SuspendedLayout)
{
// Search for the object that you want to set the size on
// Note cell.Name contains the Id of the chart
foreach (var cell in sheet.Properties.Cells)
{
if (cell.Name == barchart.Id)
{
cell.Col = 1;
cell.Row = 1;
cell.Rowspan = 2;
cell.Colspan = 5;
}
}
}
Best regards
Lars-Göran Book
My bet is that the
var text1Cell = sheet.CellFor(text1);
Is accessing the layout, try moving it outside the suspended layout region.
Regards,
Johan Tejle
12 jan 2015 kl. 01:00 skrev Prabhu appu <qcwebmaster@qlikview.com<mailto:qcwebmaster@qlikview.com>>:
Hi Johan,
Thanks for the reply. I tried it outside the suspended layout. But I'm not getting any error. also I couldn't see the size changing
Prabhu Appu
Strange, the effects should be automatically applied when you exit suspended layout.
/Johan Tejle
12 jan 2015 kl. 06:18 skrev Prabhu appu <qcwebmaster@qlikview.com<mailto:qcwebmaster@qlikview.com>>:
Hi,
this code should work:
using (sheet.SuspendedLayout)
{
// Search for the object that you want to set the size on
// Note cell.Name contains the Id of the chart
foreach (var cell in sheet.Properties.Cells)
{
if (cell.Name == barchart.Id)
{
cell.Col = 1;
cell.Row = 1;
cell.Rowspan = 2;
cell.Colspan = 5;
}
}
}
Best regards
Lars-Göran Book
Hi Lars,
Thanks for the answer. It is working good.
Regards,
Prabhu Appu