Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prabhuappu
Creator II
Creator II

Couldn't change the size of the Object using Qliksense .Net SDK

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,

https://help.qlik.com/sense/en-us/developer/#../Subsystems/NetSdk/Content/HowTos/NetSdk_HowTo_AddObj...

Please help....

Thanks in Advance

Prabbhu Appu

1 Solution

Accepted Solutions
Not applicable

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

View solution in original post

5 Replies
Not applicable

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>>:

prabhuappu
Creator II
Creator II
Author

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

Not applicable

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>>:

Not applicable

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

prabhuappu
Creator II
Creator II
Author

Hi Lars,

Thanks for the answer. It is working good.

Regards,

Prabhu Appu