Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

prabhuappu
Contributor 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

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

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

5 Replies
Not applicable

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

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
Contributor II

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

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

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

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

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

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
Contributor II

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

Hi Lars,

Thanks for the answer. It is working good.

Regards,

Prabhu Appu

Community Browser