We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

IPageSetup versus direct access

Hi:

I am working on performance of my component.

I noticed that in your examples you do things like:
IPageSetup pageSetup = ( IPageSetup )sheet.PageSetup;
pageSetup.LeftHeaderImage = bmp;
pageSetup.LeftHeader = "&G";

I was wondering if this convention is more or less performant than access the properties directly ..
sheet.PageSetup.LeftHeaderImage = bmp;

I have also noticed this done for IStyle. My problem is that each cell could be different so to set a default column style doesnt really work for me.

Also, could you explain what a IMigrantRange is and when it might be used?

Thanks,
Kelley





1 Reply

YG Yavanaarasi G Syncfusion Team April 24, 2008 07:35 AM UTC

Hi Kelley,

Sorry for the delay in responding.

1.more or less performant:

Generally if you create object it takes more time, direct access is better performance. But both the codes are same.

2.Default column style doesn't work:

I am not able to reproduce the issue that you mentioned here. I have created a simple sample and tested this issue in the following environment winxp with servicepack2, office 2003, v6.2.0.40, .Net Framework 2.0. But here it works fine.

Here is the code snippet:


[C#]
IStyle columnStyle = workbook.Styles.Add("ColStyle");
columnStyle.ColorIndex = ExcelKnownColors.Blue;
//Set the Tempate Default Style[ Select All + Changing Formatting in MS Excel]
sheet.SetDefaultColumnStyle(2,columnStyle);
IStyle columnStyle1 = workbook.Styles.Add("ColStyle1");
columnStyle1.ColorIndex = ExcelKnownColors.Red;
//Set the Tempate Default Style[ Select All + Changing Formatting in MS Excel]
sheet.SetDefaultColumnStyle(3, columnStyle1);


Please refer the sample in the below link which illustrates the above:
http://websamples.syncfusion.com/samples/XlsIO.Windows/I-72977/main.htm

Please have a look at the above sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Please provide the system details and the office version in which the issue caused.

3.what a IMigrantRange is and when it might be used?:

"IMigrantRange" is an optimal way for writing simple strings and strings with styles, which improves the performance.

Here is the code snippet:


IMigrantRange migrantRange = sheet.MigrantRange;
migrantRange.ResetRowColumn(6,4);
migrantRange.Value = "INVENTORY REPORT";
migrantRange.CellStyle.Font.Bold= true;
migrantRange.CellStyle.Font.Size=16;



Also please refer our shipped browser sample to know about migrantRange:

\Syncfusion\EssentialStudio\x.x.x.x\Windows\XlsIO.Windows\Samples\2.0\DataManagement\RangeManipulation\CS


Please let me know if you have any other concerns.

Regards,
G.Yavana



Loader.
Live Chat Icon For mobile
Up arrow icon